A series ends on a high value. Forecast the next steps, and watch the forecast lean back while its interval opens like a fan.
Why forecasts fan out
A series where each value is 0.8 times the last plus noise, ending at 5, and its forecast 20 steps ahead (seeds 10200, 10201).
The series ends at 5, well above its mean of 0. Where will it go next?
Predict first. Looking further ahead, what will the 95 % interval of the forecast do?
Describe this picture
One panel: the last 60 of 100 values of a series (seed 10200) in which each value is 0.8 times the one before plus fresh noise of variance 1, ending at 5, well above its mean of 0, which is a dashed line. Before the clip a question asks what the 95 % interval of the forecast does as it looks further ahead: keeps opening, stops opening at some width, or narrows. A tap picks one and starts the clip. In the clip, over 8 seconds, a forecast line leaves the series and decays towards 0 over 20 steps, and a shaded 95 % interval opens around it as a fan, widest at the right; its half-width grows from 1.96 one step ahead towards a limit of 3.27, labelled at the end. Then 24 of 1000 simulated futures (seed 10201) appear as faint lines through the fan, and a readout gives the share of all their points that fall inside it: 95.7 %. Readouts also give the coefficient and the half-widths one and 20 steps ahead. After the clip a slider sets the coefficient from 0 to 1 in steps of 0.05; at 1 the fan keeps opening.
A forecast and its interval
Before the clip you guessed. The fan opens fast at first and then stops: its half-width creeps up towards 3.27 and never passes it. Each step ahead adds new noise to the uncertainty, but the series also forgets, and the two balance. In the clip, 95.7 % of the points of 1000 simulated futures fell inside the fan, against the nominal 95 %.
The forecast itself leans back to the mean. The series is high now, and it remembers that, but its memory fades by a factor of 0.8 a step, so the forecast fades too.
After the clip, drag the coefficient to 1. The series becomes a random walk, which never forgets: the forecast stays at 5, and the fan keeps opening, wider and wider, as the square root of the horizon.
The autoregressive model
The picture’s series is the AR(1) series of Time series and autocorrelation. Allowing more of the past gives the autoregressive model of order , AR():
with white noise of variance and coefficients . Today’s value is a weighted sum of recent values plus a fresh surprise.
The model is stationary when its memory fades rather than builds up. For AR(1) that means . For AR() it means every root of lies outside the unit circle. A coefficient of 1.05 makes AR(1) explode, not settle.
Fitting the model
By regression. An AR() model is a regression of each value on its predecessors, so Linear regression fits it: least squares of on .
By the autocorrelation. Multiply the model by and take means. For AR(2), with short for , lags 1 and 2 give the Yule–Walker equations:
Put in the sample autocorrelations and solve for the coefficients. The matrix is symmetric with constant diagonals, the structure of Positive definite matrices.
Partial autocorrelation
How do you pick the order ? The autocorrelation of an AR(1) series does not stop at lag 1; it fades like . A better tool is the partial autocorrelation at lag : the last coefficient of the best AR() fit. It measures what lag adds once the lags in between are accounted for. For an AR() series it is 0 beyond lag : it cuts off, and the cut-off shows the order. Criteria such as the AIC of Overfitting and model choice make the choice a rule.
Forecasts and their uncertainty
For AR(1) about a mean of 0, the forecast steps ahead of the last value is
which decays to the mean. Its error collects the noise of the steps not yet seen, each faded by the steps after it, so its variance is
rising towards the series’ own variance : far ahead, the forecast knows no more than the mean. For a random walk, , the variance is and grows without limit.
Watch out
A model that fits the past well does not forecast far ahead well. For a stationary model the forecast returns towards the mean, faster the weaker its memory, and the interval widens to the series’ whole spread.
The same model as a filter
An AR(1) series is white noise passed through a one-pole filter. Its spectrum shows the same memory in frequency.
Slow wandering, seen as a spectrum
The power of the series at each frequency: white noise through a one-pole filter with coefficient 0.8.
The series as white noise through a one-pole filter: its power at each frequency Ω.
Describe this picture
One panel: the spectrum of the AR(1) series with coefficient 0.8 and noise variance 1, drawn in decibels against frequency from 0 to radians per sample. The clip traces it from left to right, then marks both ends: 25 (14.0 dB) at and 0.309 (−5.1 dB) at , with a dashed bracket for the ratio of 81, or 19.1 dB. Readouts give both values and the ratio. The panel has a play button and no other control.
Slow swings dominate: the series’ memory, in the lag domain, is the same fact as its power at low frequencies.
Moving-average models, in one line
A different model mixes recent noise instead of recent values: the moving-average model MA(1), , has and no autocorrelation beyond lag 1. Combining both kinds gives ARMA models.
Worked example
1. Fitting the short series. For the series of Time series and autocorrelation, with deviations from the mean 3, the regression of each deviation on the one before gives
the same as , because the last deviation, , is 0.
2. Forecasting. With , and :
| Steps ahead | Forecast | Error variance | 95 % half-width |
|---|---|---|---|
| 1 | 4.0 | 1 | 1.96 |
| 2 | 3.2 | 1.64 | 2.51 |
| 3 | 2.56 | 2.0496 | 2.81 |
| 4 | 2.048 | 2.3117 | 2.98 |
| 5 | 1.6384 | 2.4795 | 3.09 |
| far ahead | 0 | 2.7778 | 3.27 |
At 12 steps ahead the half-width is 3.26, nearly at its limit. With the limit is lower, 2.26. A random walk has a half-width of at 4 steps and at 12, still growing.
3. Yule–Walker for AR(2). Take and , a stationary pair. Its autocorrelations are and . Solving the two equations with these values returns : the determinant is , and . The partial autocorrelation is 0.3 at lag 2 and 0 at lag 3.
4. A moving average. MA(1) with has ; no MA(1) gets above 0.5, reached at .
Try it yourself. Two steps ahead from with , the forecast is 3.2. A coefficient of 1.05 is not stationary. The partial autocorrelation of an AR(2) series is 0 beyond lag 2.
Where you’ll meet this
Forecasting. Demand, electricity load and temperature are forecast with autoregressive models and their fans; planners use the fan, not just the line.
Speech coding. Linear prediction fits an AR model to each short frame of speech, and sends the coefficients and the small prediction error instead of the samples.
Tracking. The Kalman filter often models the motion it tracks as an autoregressive process, predicting one step ahead and correcting with each measurement.
In signal processing · linear prediction
Signal processing writes the same model as , so . The partial autocorrelation at lag is then minus the reflection coefficient of the Levinson–Durbin recursion in Linear prediction, and a stationary AR model is a stable all-pole filter, as in Stability and causality.
Reference card
| Quantity | Formula | Notes |
|---|---|---|
| AR() | regression on the past | |
| Stationary AR(1) | AR(): roots outside the unit circle | |
| Yule–Walker | autocorrelations in, coefficients out | a symmetric Toeplitz system |
| Partial autocorrelation | last coefficient of the best AR() fit | 0 beyond lag |
| AR(1) forecast | leans back to the mean | |
| Forecast error variance | tends to | |
| Random walk | the fan never stops opening | |
| MA(1) | 0 beyond lag 1 |