Instant PDF download, name-and-email checkout. Complete Book Bundle: every Economics, Statistics, Mathematics and Econometrics book
Econometrics guide, Unit 5, step 19 of 20Previous stepNext step

Step 19: Forecasting and Cointegration

SyllabusUndergraduate econometrics · Wooldridge, Introductory Econometrics, Ch. 18
In 30 seconds
  • Forecasting is judged by the size of errors on data the model has not seen, not by causal coefficients. Always compare a model with a naive benchmark.
  • An AR(\( p \)) model regresses a series on its own lags; choose \( p \) with AIC or BIC. For quarterly US inflation, 1959–2009, both pick three lags, and three lags also forecast best out of sample.
  • Forecasts are iterated forward, and forecast intervals widen with the horizon. For the inflation AR(1), the one-quarter 95% interval is ±4.89 points.
  • Granger causality means predictive content, not a causal effect: the T-bill rate “Granger-causes” inflation (\( p = 0.014 \)), with a sign that reflects anticipation.
  • Cointegrated I(1) series share a stationary long-run relationship. US log consumption and log GDP pass the Engle–Granger test (\( -3.535 \), \( p = 0.029 \)); their error-correction model closes about 6% of any gap each quarter.
Video lesson coming soonA short animated lesson for this step will appear here.

What you will learn

  • how forecasting differs from causal estimation, and the notation of \( h \)-step-ahead forecasts;
  • naive and seasonal naive benchmarks;
  • how to estimate an AR(\( p \)) model, choose \( p \) with AIC and BIC, and compute forecasts and forecast intervals by hand;
  • ARIMA models and the Box–Jenkins approach, in outline;
  • ADL models and the Granger causality test, and what the result does and does not mean;
  • how to evaluate forecasts with RMSE, MAE and MAPE, hold-out samples and pseudo out-of-sample exercises;
  • the Engle–Granger test for cointegration and the error-correction model.

Forecasting is a different job

Most of this guide has been about causal questions, where one coefficient must be protected from omitted variables, reverse causality and selection. A forecaster asks “what will \( y \) be next quarter?”, and only the accuracy of the answer matters. If many people carry umbrellas in the morning, rain is likely in the afternoon, because people check the weather forecast. Umbrellas are an excellent predictor, yet banning them would not stop the rain. For forecasting, the direction of causation does not matter; what matters is that the relationship is stable, holding in the forecast period as it did in the sample.

Key termA forecast of \( y_{T+h} \) made with information up to period \( T \) is written \( \hat y_{T+h|T} \); \( h \) is the forecast horizon. The forecast error is \( e_{T+h|T} = y_{T+h}-\hat y_{T+h|T} \), outcome minus forecast. The forecast with the smallest mean squared error is the conditional mean, \( E(y_{T+h} \mid \mathcal{I}_T) \). Every predictor in a forecasting equation must be known at \( T \), so it must be lagged.
Econometrics Made Simple textbook coverChapter 19 of Econometrics Made Simple covers this in full: AR and ARIMA forecasting, forecast intervals, Granger causality, forecast evaluation and error-correction models.Get the textbook · $15

A model’s in-sample fit always improves when parameters are added. Its out-of-sample performance usually improves at first and then gets worse, because extra parameters start fitting the noise particular to the sample. That is overfitting, and it is why a model must be judged on data it has not seen.

Naive benchmarks

Before building a model, you need something to beat. The naive (no-change, random-walk) forecast is \( \hat y_{T+h|T} = y_T \): today’s value. The seasonal naive forecast is last year’s value for the same season, \( \hat y_{T+h|T} = y_{T+h-s} \). The mean forecast is the sample average. The naive forecast is famously hard to beat for exchange rates and share prices, and poor for seasonal series.

Worked example

In the book’s simulated retail data, sales were 205.6 in December 2023 and 169.1 in January 2023. Sales in January 2024 turned out to be 179.7. Find the naive and seasonal naive forecasts for January 2024, made at the end of December 2023, and their errors.

Step 1Naive: \( \hat y = 205.6 \); error \( = 179.7-205.6 = -25.9 \). It carries the December peak into January.
Step 2Seasonal naive: \( \hat y = 169.1 \); error \( = 179.7-169.1 = 10.6 \). It handles the season but misses the upward trend.

A good model should beat both by capturing the season and the trend.

Autoregressive models and lag choice

\[ \text{AR}(p)\colon\ y_t = \beta_0 + \beta_1 y_{t-1} + \cdots + \beta_p y_{t-p} + u_t, \qquad E(u_t \mid y_{t-1}, y_{t-2}, \dots) = 0 \]

The model is estimated by OLS. It is consistent provided the series is stationary (Step 18); a series with a unit root should be differenced first. The long-run mean of a stationary AR(1) is \( \mu = \beta_0/(1-\beta_1) \), and forecasts head back towards it as the horizon lengthens. The running example is quarterly US CPI inflation, annualised, 1959Q2–2009Q3 (202 quarters): mean 3.98%, from \( -8.79\% \) in 2008Q4 to 14.62%. An ADF test rejects a unit root (\( t = -3.09 \), \( p = 0.027 \)), so inflation is modelled in levels.

Formula: information criteriaWith \( T \) observations and \( k = p+1 \) coefficients, \[ \text{AIC}(p) = \ln\!\Big(\frac{\text{SSR}(p)}{T}\Big) + k\,\frac{2}{T}, \qquad \text{BIC}(p) = \ln\!\Big(\frac{\text{SSR}(p)}{T}\Big) + k\,\frac{\ln T}{T}. \] Choose the \( p \) with the smallest value, comparing all models on the same sample. BIC’s penalty is larger whenever \( T \ge 8 \), so it never picks more lags than AIC.

On a common sample of 194 quarters, both criteria are smallest at \( p = 3 \) (AIC 1.6878, BIC 1.7551). Going from two lags to three cuts the SSR from 1,096.8 to 1,006.6; a fourth lag cuts it by less than one unit. Re-estimated on 1960Q1–2009Q3:

\[ \widehat{\text{infl}}_t = 0.725 + 0.353\,\text{infl}_{t-1} + 0.184\,\text{infl}_{t-2} + 0.286\,\text{infl}_{t-3}, \qquad \text{SER} = 2.287 \]

The lag coefficients sum to 0.823: persistent but stationary, with long-run mean \( 0.725/(1-0.823) \approx 4.1\% \). Information criteria guard against overfitting using the estimation sample alone. A more direct check is to hold data back.

Overfitting: in-sample and out-of-sample RMSE of AR(p) models inflation, points
In-sample, 1961–1999Out-of-sample one-step forecasts, 2000–2009
0123456781.62.02.42.83.23.6number of lags pRMSEbest out of sample: p = 3
Figure 2. The in-sample error falls every time a lag is added. The out-of-sample error falls only up to three lags (3.247) and then rises again: lags 4 to 8 fitted noise. Numbers from Econometrics Made Simple, Chapter 19, Table 19.1.

Forecasts and forecast intervals

For an AR(1), the one-step forecast replaces the unknown shock by zero, \( \hat y_{T+1|T} = \hat\beta_0 + \hat\beta_1 y_T \). Two steps ahead you would need \( y_{T+1} \), so the iterated method plugs in its forecast: \( \hat y_{T+h|T} = \hat\beta_0 + \hat\beta_1 \hat y_{T+h-1|T} \).

Worked example

The AR(1) for inflation, estimated on 1959Q3–2009Q3, is \( \widehat{\text{infl}}_t = 1.423 + 0.644\,\text{infl}_{t-1} \), with \( \hat\sigma = 2.495 \). Inflation in 2009Q3 was 3.56%. Forecast 2009Q4 and 2010Q1, give 95% intervals, and find the long-run mean.

Step 12009Q4: \( 1.423 + 0.644 \times 3.56 = 3.716 \), about 3.72%.
Step 22010Q1: \( 1.423 + 0.644 \times 3.716 = 3.816 \), about 3.82%.
Step 3One-step interval: \( 3.72 \pm 1.96 \times 2.495 = 3.72 \pm 4.89 \), so \( [-1.17,\ 8.61] \).
Step 4Two-step standard error: \( 2.495\sqrt{1 + 0.644^2} = 2.968 \); interval \( 3.82 \pm 5.82 \), about \( [-2.00,\ 9.63] \) with unrounded numbers.
Step 5Long-run mean: \( 1.423/0.356 = 4.00\% \). The half-width tends to \( 1.96 \times 2.495/\sqrt{1-0.644^2} = 6.39 \) points.

The intervals are wide because quarterly US inflation is noisy. An honest forecaster says so: even one quarter ahead, anything from mild deflation to over 8% is plausible.

\[ \text{AR(1), } h \text{ steps: } \hat y_{T+h|T} \pm 1.96\,\hat\sigma\sqrt{1 + \hat\beta_1^2 + \hat\beta_1^4 + \cdots + \hat\beta_1^{2(h-1)}} \]

Two steps ahead, the forecaster is uncertain about two future shocks: the error is \( u_{T+2} + \beta_1 u_{T+1} \), with variance \( \sigma_u^2(1 + \beta_1^2) \). Each extra step adds another shock, and the variance approaches the unconditional variance of \( y \). So never use \( \pm 1.96\hat\sigma \) beyond one step. These intervals also ignore coefficient uncertainty and assume the model is stable, so if anything they are too narrow.

US inflation and AR(1) forecasts from 2009Q3 % a year
Inflation (actual)AR(1) forecast, 2009Q4 to 2011Q395% forecast interval
2000200220042006200820102012-10-5051015% (annualised)long-run mean 4.0%2008Q4: −8.79%
Figure 1. The forecasts climb from the last value, 3.56%, towards the long-run mean of 4.0%, closing 35.6% of the gap each quarter. The 95% interval widens from ±4.89 points one quarter ahead to about ±6.39 points, the limit set by the spread of inflation itself. Data: us_macro.csv; model from Chapter 19.

For the AR(3), the one-step forecast from 2009Q3 is 2.87% (standard error 2.29); twelve quarters ahead it is 3.80% (standard error 3.16). Central banks publish exactly this kind of picture: the Bank of England’s fan charts, introduced in the mid-1990s, widen with the horizon for the same reason.

ARIMA models in outline

AR models use past values of \( y \); moving-average models use past shocks. An MA(1), \( y_t = \mu + u_t + \theta_1 u_{t-1} \), has a one-period memory. An ARMA(\( p,q \)) combines both, and an ARIMA(\( p,d,q \)) is an ARMA for the series differenced \( d \) times; ARIMA(0,1,0) is the random walk. Because the shocks are not observed, these models are estimated by maximum likelihood. The Box–Jenkins cycle is: identify (difference if needed, read the ACF and PACF), estimate candidates and compare AIC and BIC, check that the residuals look like white noise, then forecast.

For inflation, AIC prefers the AR(3) (912.79 against 915.67) and BIC the ARMA(1,1) (928.91 against 929.33). The ARMA(1,1) is \( \text{infl}_t-3.77 = 0.932(\text{infl}_{t-1}-3.77) + u_t-0.572u_{t-1} \). A one-point shock raises next quarter’s inflation by only \( 0.932-0.572 = 0.36 \) points, and what remains fades slowly. Its 2009Q4 forecast is 2.27%, but the 95% intervals of the three models overlap almost completely: with data this noisy, the choice between reasonable models matters less than the width of the interval.

Econometrics Made Simple practice questions coverPractise forecasts, intervals, AIC and BIC and ECM interpretation with worked answers. Over 1,150 practice questions, every one with a worked answer.Practice book · $9

ADL models and Granger causality

An autoregressive distributed lag model adds lags of a predictor \( x \) to an AR model. Every term is dated \( t-1 \) or earlier, so the one-step forecast uses only data known at \( T \).

\[ \text{ADL}(p,q)\colon\ y_t = \beta_0 + \beta_1 y_{t-1} + \cdots + \beta_p y_{t-p} + \delta_1 x_{t-1} + \cdots + \delta_q x_{t-q} + u_t \]
Key term\( x \) Granger-causes \( y \) if past values of \( x \) help predict \( y \) once past values of \( y \) are in the model. The Granger causality test is the F test of \( H_0\colon \delta_1 = \cdots = \delta_q = 0 \) (see Step 7).

With three lags of each, the three-month Treasury-bill rate Granger-causes inflation (\( F = 3.62 \) with 3 and 192 degrees of freedom, \( p = 0.014 \)). Unemployment does so only at 10% (\( F = 2.35 \), \( p = 0.074 \)). In reverse, inflation Granger-causes unemployment (\( F = 3.84 \), \( p = 0.011 \)): feedback both ways is common.

Look at the T-bill coefficients, though: 0.658 on the first lag and \( -0.625 \) on the second. A rise in the rate is followed by higher inflation next quarter. That does not contradict monetary theory. The Federal Reserve raises rates when it sees inflation coming, and investors demand higher yields when they expect it. The rate moves first because people anticipate inflation, just as umbrellas appear before the rain.

Common mistakeWriting “the test shows that interest rates cause inflation”. Write “lags of the T-bill rate have significant predictive content for inflation, given lags of inflation”, or “the T-bill rate Granger-causes inflation”, and explain what that means. Always keep the word Granger.

Evaluating forecasts

Estimate on a training sample and forecast a hold-out sample, then summarise the \( m \) forecast errors:

\[ \text{RMSE} = \sqrt{\frac{1}{m}\sum_{j=1}^{m} e_j^2}, \qquad \text{MAE} = \frac{1}{m}\sum_{j=1}^{m} |e_j|, \qquad \text{MAPE} = \frac{100}{m}\sum_{j=1}^{m} \left|\frac{e_j}{y_j}\right| \]

RMSE punishes large misses heavily; MAE treats every point of error alike. MAPE is unit-free, but it explodes when \( y \) is near zero and is meaningless for inflation or growth, so use it only for series well above zero, such as sales. For the retail data, forecasting all of 2024 from the end of 2023, the model with a trend and month dummies wins on every measure.

Forecast for 2024RMSEMAEMAPE (%)
Naive (December 2023 value)20.2018.5810.10
Seasonal naive5.945.002.61
Trend only9.467.173.79
Trend + month dummies3.012.671.44

A pseudo out-of-sample exercise mimics a real forecaster: for each date in a test period, estimate using only earlier data, forecast, record the error, and move on (an expanding window keeps all past data; a rolling window keeps a fixed length). For one-step inflation forecasts over 2000Q1–2009Q3 (39 quarters), the AR(3) has the lowest RMSE, 3.331, against 3.815 for the naive forecast. The average of the last four quarters, which needs no estimation, is only 0.03 behind. Adding the Granger-significant T-bill rate raises the RMSE to 3.448: in-sample significance does not guarantee out-of-sample gains. And only 31 of the 39 outcomes lie inside the nominal 95% intervals, all eight misses coming after mid-2005, when inflation became far more volatile.

Common mistakeChoosing a model by its in-sample \( R^2 \), or evaluating forecasts on the data used to estimate the model. Both reward overfitting. Our post on R-squared vs adjusted R-squared explains why fit statistics alone mislead.

Cointegration and error correction

Differencing two I(1) series avoids spurious regression but throws away information about their levels. Some series are linked in levels: consumption and output, short and long interest rates. Think of a dog on a lead: each path wanders, but the distance between them stays bounded.

Key termTwo I(1) series are cointegrated if \( y_t-\beta_0-\beta_1 x_t \) is stationary. The Engle–Granger two-step test: (0) check both series are I(1); (1) regress \( y_t \) on \( x_t \) in levels and save the residuals; (2) run an ADF test on the residuals with no constant, comparing the statistic with Engle–Granger critical values (about \( -3.90 \), \( -3.34 \) and \( -3.04 \) at 1%, 5% and 10% for two variables), not ordinary DF values.
Worked example

Test whether US log real consumption and log real GDP, 1959Q1–2009Q3, are cointegrated.

Step 0Neither series rejects a unit root in levels (\( p = 0.309 \) and 0.389, with a trend); both reject strongly in differences. Both are I(1).
Step 1Long-run regression: \( \widehat{\ln C_t} = -1.076 + 1.075\,\ln \text{GDP}_t \). Its usual t statistics are not reported, because they mean nothing unless the series are cointegrated.
Step 2Engle–Granger statistic \( = -3.535 \), \( p = 0.029 \). It is below the 5% critical value for this sample, \( -3.37 \), but not the 1% value, \( -3.95 \).

Reject “no cointegration” at 5%. (By contrast, consumption and disposable income fail the same test, as Step 18 showed.) For the unit-root step itself, see our post on the augmented Dickey–Fuller test.

\[ \text{ECM: } \Delta y_t = \alpha_0 + \gamma\,\hat e_{t-1} + \delta\,\Delta x_t + u_t, \qquad \hat e_{t-1} = y_{t-1}-\hat\beta_0-\hat\beta_1 x_{t-1}, \qquad \gamma < 0 \]

Every term is stationary when the series are cointegrated, so OLS and the usual standard errors are valid. For consumption and GDP the estimated ECM is \( \widehat{\Delta \ln C_t} = 0.0042-0.0586\,\hat e_{t-1} + 0.537\,\Delta\ln\text{GDP}_t \), with \( t = -2.26 \) on the speed of adjustment. If consumption is 2% above its long-run level, the error-correction term lowers this quarter’s consumption growth by \( 0.0586 \times 0.02 = 0.0012 \), about 0.12 percentage points. Half of a gap takes \( \ln 0.5/\ln 0.9414 = 11.5 \) quarters to close, almost three years. The short-run coefficient, 0.537, says consumption responds to only about half of a change in output straight away, in line with consumption smoothing.

Exam tipWhen you report an ECM, give the long-run relationship, \( \hat\gamma \) as the fraction of the gap closed per period, the short-run coefficient, and the Engle–Granger critical value you used. And always report a naive benchmark alongside any forecasting model: examiners look for the comparison.

Practise: 6 questions

Try each one on paper first, then check the worked answer.

EasyQ1. Monthly ticket sales were 340 in December 2025 and 280 in January 2025. January 2026 sales turned out to be 295. Find the naive and seasonal naive forecasts for January 2026, made at the end of December 2025, and their errors. Show worked answer
Naive: \( \hat y = 340 \); error \( = 295-340 = -45 \) (forecast too high: it carries the December peak forward).
Seasonal naive: \( \hat y = 280 \); error \( = 295-280 = 15 \) (forecast too low: it misses growth since last year).
EasyQ2. Four hold-out forecast errors are 2, \( -1 \), 3 and \( -2 \). Compute the MAE and the RMSE, and explain why the RMSE is larger. Show worked answer
MAE \( = (2 + 1 + 3 + 2)/4 = 2.00 \).
RMSE \( = \sqrt{(4 + 1 + 9 + 4)/4} = \sqrt{4.5} = 2.12 \).
Squaring gives the largest error (3) extra weight. RMSE equals MAE only when every error has the same size.
MediumQ3. An AR(1) is \( \hat y_t = 0.9 + 0.7\,y_{t-1} \) with \( \hat\sigma = 1.5 \), and \( y_T = 5 \). Find the one-step and two-step forecasts with 95% intervals, and the long-run mean. Show worked answer
One step: \( 0.9 + 0.7 \times 5 = 4.40 \); interval \( 4.40 \pm 1.96 \times 1.5 = 4.40 \pm 2.94 \), so \( [1.46,\ 7.34] \).
Two steps: \( 0.9 + 0.7 \times 4.40 = 3.98 \); standard error \( 1.5\sqrt{1 + 0.49} = 1.83 \); interval \( 3.98 \pm 3.59 \), so \( [0.39,\ 7.57] \).
Long-run mean \( 0.9/(1-0.7) = 3.0 \).
MediumQ4. On a common sample of \( T = 100 \), AR models give SSR = 250 (\( p = 1 \)), 232 (\( p = 2 \)) and 225 (\( p = 3 \)). Compute AIC and BIC for each and say which \( p \) each chooses. Show worked answer
\( k = p + 1 \). AIC \( = \ln(\text{SSR}/100) + 2k/100 \); BIC \( = \ln(\text{SSR}/100) + k \ln 100/100 \), with \( \ln 100/100 = 0.0461 \).
\( p = 1 \): AIC \( = 0.9163 + 0.04 = 0.956 \); BIC \( = 0.9163 + 0.0921 = 1.008 \).
\( p = 2 \): AIC \( = 0.8416 + 0.06 = 0.902 \); BIC \( = 0.8416 + 0.1382 = 0.980 \).
\( p = 3 \): AIC \( = 0.8109 + 0.08 = 0.891 \); BIC \( = 0.8109 + 0.1842 = 0.995 \).
AIC chooses \( p = 3 \); BIC chooses \( p = 2 \). BIC’s heavier penalty makes the third lag not worth its cost.
MediumQ5. In an ADL model for a country’s inflation, three lags of world oil prices are jointly significant (\( F = 4.1 \), \( p = 0.008 \)) given three lags of inflation. State what you may and may not conclude, and one reason the oil lags might still not improve forecasts. Show worked answer
May conclude: oil prices Granger-cause inflation; their past values carry information about future inflation not already in past inflation.
May not conclude: that raising or lowering oil prices would change inflation by the estimated amounts. The test is about prediction; a third factor (such as world demand) could move both, with oil reacting faster.
Out of sample, the extra coefficients add estimation noise, and the relationship may not be stable over the forecast period, so a pseudo out-of-sample check is still needed.
ExamQ6. Log sales \( s_t \) and log prices \( p_t \) are both I(1). The Engle–Granger statistic is \( -4.10 \) (5% critical value \( -3.34 \)). The ECM is \( \widehat{\Delta s_t} = 0.002-0.20\,\hat e_{t-1} + 0.45\,\Delta p_t \). (a) State the conclusion of the cointegration test. [2] (b) If \( \hat e_{t-1} = 0.05 \), by how much does the error-correction term change \( \Delta s_t \)? [2] (c) Find the half-life of a deviation from the long-run relationship. [2] (d) Why can the usual t statistic on \( \hat e_{t-1} \) be used here? [1] Show worked answer
(a) \( -4.10 < -3.34 \), so reject the null of no cointegration at 5%. [1] The two series share a stable long-run relationship; the levels regression is not spurious. [1]
(b) \( -0.20 \times 0.05 = -0.010 \) [M1]: sales growth is 0.010 lower, about 1 percentage point, this period. [A1]
(c) \( 0.8^n = 0.5 \), so \( n = \ln 0.5/\ln 0.8 \) [M1] \( = 3.11 \) periods. [A1]
(d) Because the series are cointegrated, every term in the ECM is I(0), so standard inference applies. [1]
Total: 7 marks.

Check yourself

1. As the forecast horizon of a stationary AR(1) grows, the forecast

\( \hat y_{T+h|T}-\mu = \beta_1^h (y_T-\mu) \to 0 \) when \( |\beta_1| < 1 \). The interval widens towards the spread of the series.

2. Which statistic should you not use for quarterly inflation forecasts?

MAPE divides by the outcome, so it explodes when inflation is near zero and is meaningless when it is negative.

3. In an error-correction model the speed-of-adjustment coefficient should be

If \( y \) is above its long-run level (\( \hat e_{t-1} > 0 \)), a negative \( \gamma \) slows its growth and the gap closes. US consumption: \( -0.0586 \).

Your score: 0 out of 3

The short version

  • Forecasts aim at small errors on future outcomes; overfitting and structural change are the dangers. Always report a naive or seasonal naive benchmark.
  • AR(\( p \)) by OLS, \( p \) by AIC or BIC. For US inflation both choose \( p = 3 \), which also forecasts best out of sample (RMSE 3.247 against 3.398 with eight lags).
  • Iterate forecasts forward; the 95% interval is \( \pm 1.96\hat\sigma \) only one step ahead and widens after that.
  • Granger causality is predictive content, not a causal effect. The T-bill rate Granger-causes inflation, but adding it did not improve out-of-sample forecasts.
  • Judge forecasts with RMSE, MAE and (for positive series) MAPE on data the model has not seen.
  • Cointegration needs Engle–Granger critical values. US log consumption and log GDP pass (\( -3.535 \)); in their ECM about 6% of a gap closes each quarter.
  • Chapter 19 of Econometrics Made Simple covers forecasting and cointegration in full, with code in Python, R and Stata. Studying across subjects? The Complete Book Bundle includes every Economics, Statistics, Mathematics and Econometrics book.
Econometrics Made Simple complete bundle coverForecasting, cointegration and every other topic in the guide. Get the textbook and the practice book together for $19 (was $24).Both books · $19
Want more questions like these, with worked answers?
The practice book has over 1,150 more, graded from easy to exam level.
Next: step 20 of 20Doing an Empirical Project