Step 19: Forecasting and Cointegration
- 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.
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.
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.
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.
A good model should beat both by capturing the season and the trend.
Autoregressive models and lag choice
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.
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:
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.
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} \).
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.
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.
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.
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.
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 \).
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.
Evaluating forecasts
Estimate on a training sample and forecast a hold-out sample, then summarise the \( m \) forecast errors:
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 2024 | RMSE | MAE | MAPE (%) |
|---|---|---|---|
| Naive (December 2023 value) | 20.20 | 18.58 | 10.10 |
| Seasonal naive | 5.94 | 5.00 | 2.61 |
| Trend only | 9.46 | 7.17 | 3.79 |
| Trend + month dummies | 3.01 | 2.67 | 1.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.
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.
Test whether US log real consumption and log real GDP, 1959Q1–2009Q3, are cointegrated.
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.
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.
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
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
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
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
\( 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 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
(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
2. Which statistic should you not use for quarterly inflation forecasts?
3. In an error-correction model the speed-of-adjustment coefficient should be
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.
Further reading on EconTutorials
Related in-depth articles from our blog:
- The Augmented Dickey–Fuller Test: Stationarity and Unit Roots Explained
- R-Squared vs Adjusted R-Squared: What They Mean and When to Use Each
- The Durbin–Watson Test for Autocorrelation: How to Run and Interpret It
- Hypothesis Testing in Economics: t-Tests, p-Values, and Statistical Significance
- What Is Regression Analysis?
