
Lecture 7: Cycles I, Stationarity and Autoregression
08 October 2026
Previously we wrote y_t = T_t + S_t + C_t + \varepsilon_t and dealt with trend and seasonality. Both are deterministic: fixed functions of the calendar, hence trivial to extrapolate.
Every residual plot in that lecture told the same story: what was left over has rich dynamics.
That the third component C_t - the cycle.

When you hear “cycle” you may picture the rigid up-and-down pattern on the left. Fluctuations in business, finance and economics are rarely that regular.
What we mean by a cycle is any stable, mean-reverting dynamics not captured by the trend or the seasonal: the series is persistent, yet shocks eventually die out and the series returns toward a fixed mean. The right panel qualifies; so does every residual series from the previous lecture.
Trend and seasonal dynamics were simple to model. Cyclical dynamics are richer, and so are the models…
Today:
the language for describing such dynamics (covariance stationarity, autocorrelation)
the simplest model that produces them (the autoregression)
how to forecast with it (Wold’s chain rule).
Diebold, Forecasting in Economics, Business, Finance and Beyond, Chapter 6. Sections 1 to 3 also draw on Pesaran (2015), Time Series and Panel Data Econometrics, Chapter 14.

Stationarity requires the “patterns” to be invariant across time.
Because only means and covariances are restricted, covariance stationarity is also called second-order stationarity. It says nothing about skewness, kurtosis, or the shape of the distribution.
\gamma(\tau) = E[(y_t - \mu)(y_{t-\tau} - \mu)], viewed as a function of \tau, is the basic summary of a stationary series’ dynamics.
So we standardize. The autocorrelation function is
\rho(\tau) = \frac{\operatorname{cov}(y_t, y_{t-\tau})}{\sqrt{\operatorname{var}(y_t)}\sqrt{\operatorname{var}(y_{t-\tau})}} = \frac{\gamma(\tau)}{\sqrt{\gamma(0)}\sqrt{\gamma(0)}} = \frac{\gamma(\tau)}{\gamma(0)}, \qquad \tau = 0, 1, 2, \ldots
using that under stationarity both variances equal \gamma(0). Always \rho(\tau) \in [-1, 1] and \rho(0) = 1; only the displacements beyond 0 carry information.
The partial autocorrelation at displacement \tau, p(\tau), is the coefficient on y_{t-\tau} in the population linear regression
y_t \;\text{ on }\; y_{t-1},\, y_{t-2},\, \ldots,\, y_{t-\tau} .
Such regressions are called autoregressions: the variable is regressed on its own lags.
Like \rho(0), p(0) = 1 by construction. Plots of both functions start at displacement 1.
“Population regression”: imagine an infinite sample, so that the coefficients are the true values, free of sampling variation.

All the processes we study have autocorrelations and partial autocorrelations that approach zero as the displacement grows. How they approach zero is the fingerprint we will read.
Otherwise one realization could never reveal the mean. Strictly this is an ergodicity condition on top of stationarity; Diebold folds it into the definition.
Many economic series are not covariance stationary. A trend is a mean that rises over time; seasonality is a mean that varies with the season. Both violate requirement 1.
Two strategies make the assumption workable nonetheless:

The tell-tale sign of a trend: a sample ACF that barely decays (left). In growth rates the same data show modest, quickly fading persistence (right).
Before estimating anything we need the population properties of a few time series processes. The simplest one is the block from which all others are built:
y_t = \varepsilon_t, \qquad \varepsilon_t \sim (0, \sigma^2), \qquad \sigma^2 < \infty,
with the shock \varepsilon_t uncorrelated over time. A process with zero mean, constant variance and no serial correlation is white noise: y_t \sim WN(0, \sigma^2).
Two stronger versions, by adding assumptions:
The name is by analogy with white light, which contains every color of the spectrum in equal amounts: white noise is composed of cycles of every periodicity, in equal amounts.

There are no patterns of any kind. Whatever happened last period tells you nothing about this one.
You have met white noise before: the disturbance of a regression model is assumed to be white noise of one sort or another. The difference is that regression disturbances are unobservable, whereas here we are modeling an observed series.
Unconditional mean and variance: E(y_t) = 0 and \operatorname{var}(y_t) = \sigma^2, both constant, as they must be for any covariance stationary process.
Because the shocks are uncorrelated, every autocovariance beyond displacement 0 is zero:
\gamma(\tau) = \begin{cases} \sigma^2, & \tau = 0 \\ 0, & \tau \geq 1 \end{cases} \qquad \rho(\tau) = \begin{cases} 1, & \tau = 0 \\ 0, & \tau \geq 1 \end{cases} \qquad p(\tau) = \begin{cases} 1, & \tau = 0 \\ 0, & \tau \geq 1. \end{cases}
The partial autocorrelations vanish for the same reason: a population regression of y_t on y_{t-1}, or on y_{t-1} and y_{t-2}, or on any set of lags, produces nothing but zero coefficients.
Degenerate, yes. Also the reference point: every diagnostic we build asks how far is this series from white noise, and in what direction.
A second way to characterize dynamics: the mean and variance of y_t conditional on its past, \Omega_{t-1} = \{y_{t-1}, y_{t-2}, \ldots\}. For independent white noise,
E(y_t \mid \Omega_{t-1}) = 0, \qquad \operatorname{var}(y_t \mid \Omega_{t-1}) = E\big[(y_t - E(y_t \mid \Omega_{t-1}))^2 \mid \Omega_{t-1}\big] = \sigma^2 .
Conditional and unconditional moments coincide: there are no dynamics.
For a process with dynamics they differ. Unconditional moments must be constant, by stationarity. Conditional moments move with the information set: expected laptop sales growth next quarter may be ten percent unconditionally, but much higher given that sales grew twenty percent this quarter.
The conditional mean is exactly the object Lecture 4 called the optimal forecast under quadratic loss. Time series modeling is the business of computing it.
A good model leaves behind residuals you cannot forecast.
So we need to recognize white noise when we see it, and to test for it.
Wold (1938). Let y_t be covariance stationary with any deterministic part d_t (a constant, a trend, seasonals) removed. Then
y_t = d_t + \sum_{j=0}^{\infty} b_j\, \varepsilon_{t-j}, \qquad b_0 = 1, \qquad \sum_{j=0}^{\infty} b_j^2 < \infty,
where \varepsilon_t is the innovation, the part of y_t that the linear past cannot predict, and \varepsilon_t \sim WN(0, \sigma^2).
Read it as: every stationary process is white noise passed through a linear filter. Infinitely many coefficients look hopeless for estimation with finite data. They are not, because parsimonious models (autoregressions, coming up) imply particular sequences b_j with only a few free parameters.
Suppose the coefficients decay fast enough to be absolutely summable, \sum_j |b_j| < \infty (exponential decay is the leading case). Then, with d_t = 0:
Now we have data, and here is how to do model-free chracterizatino of the dynamics of the observed time series. The analog principle: estimate population moments by replacing expectations with sample averages.
\hat\mu = \bar y = \frac{1}{T}\sum_{t=1}^T y_t, \qquad \hat\gamma(\tau) = \frac{1}{T}\sum_{t=\tau+1}^{T} (y_t - \bar y)(y_{t-\tau} - \bar y), \qquad \hat\rho(\tau) = \frac{\hat\gamma(\tau)}{\hat\gamma(0)} .
The sample partial autocorrelation replaces the population regression by the feasible one: fit \hat y_t = \hat c + \hat\beta_1 y_{t-1} + \cdots + \hat\beta_\tau y_{t-\tau} by OLS and set \hat p(\tau) = \hat\beta_\tau. Again \hat p(1) = \hat\rho(1).
Dividing by T makes the sequence \hat\gamma(0), \hat\gamma(1), \ldots positive semidefinite, like every true autocovariance function. Dividing by T - \tau does not guarantee that.
A key result, which we simply assert: if y is white noise, then in large samples
\hat\rho(\tau) \;\sim\; N\!\Big(0, \frac{1}{T}\Big), \qquad \tau = 1, 2, \ldots,
and the sample autocorrelations at different displacements are approximately independent.
The bands judge one displacement at a time. Usually the question is joint: is the whole autocorrelation function zero?
Rewrite the result as \sqrt{T}\,\hat\rho(\tau) \sim N(0,1) and square it: T\hat\rho^2(\tau) \sim \chi^2_1. Squaring stops positive and negative values from cancelling when we add them up.
Sum m approximately independent \chi^2_1 variables and you get a \chi^2_m. Hence the Box-Pierce Q statistic
Q_{BP} = T \sum_{\tau=1}^{m} \hat\rho^2(\tau) \;\overset{d}{\sim}\; \chi^2_m, \quad \text{ under } H_0: \rho(1) = \cdots = \rho(m) = 0 in large samples.
Its finite-sample behavior is poor. A reweighting that follows the \chi^2_m more closely in small samples is the Ljung-Box Q statistic
Q_{LB} = T(T+2) \sum_{\tau=1}^{m} \frac{\hat\rho^2(\tau)}{T - \tau} \;\overset{d}{\sim}\; \chi^2_m \quad \text{ under } H_0 .
The weights (T+2)/(T-\tau) are near 1 for large T, so the two rarely disagree.
Choosing m. Too small and the test ignores most of the autocorrelation function; too large relative to T and the \chi^2 approximation deteriorates. m near \sqrt{T} is a reasonable rule of thumb.
Base R already computes each piece: acf(), pacf(), and Box.test(). Assembling them into the table a textbook prints takes one small function, which we will reuse all day.
correlogram <- function(x, m = 12, dof = 0) {
T <- length(x)
a <- acf(x, lag.max = m, plot = FALSE)$acf[-1] # rho_hat(1), ..., rho_hat(m)
p <- pacf(x, lag.max = m, plot = FALSE)$acf[, 1, 1] # p_hat(1), ..., p_hat(m)
Q <- T * (T + 2) * cumsum(a^2 / (T - 1:m)) # Ljung-Box, for m = 1, 2, ...
pv <- pchisq(Q, df = pmax(1:m - dof, 1), lower.tail = FALSE)
pv[1:m <= dof] <- NA # no p-value until m > dof
data.frame(lag = 1:m, acf = round(a, 3), pacf = round(p, 3), Q = round(Q, 2), p = round(pv, 4))
}dof is for later: when x is a residual from a model with dof estimated parameters, the null distribution of Q is better approximated by \chi^2_{m - \text{dof}}.
acf() divides by T, exactly as on the previous slide. corr_plot(), the bar-chart helper used below, is defined in the source of these slides.
Simulate a series with dynamics, an autoregression of order two (the model is explained later), and look at its correlogram.

The dashed lines are \pm 2/\sqrt{1000} = \pm 0.063. The sample autocorrelations decay gradually and stay far outside the bands for many displacements; the partial autocorrelations are large at 1 and 2 and negligible beyond. Remember that shape.
##
## Box-Pierce test
##
## data: y
## X-squared = 1795.5, df = 10, p-value < 2.2e-16
##
## Box-Ljung test
##
## data: y
## X-squared = 1805.3, df = 10, p-value < 2.2e-16
A quarterly, seasonally adjusted index of Canadian employment, 1962Q1 to 1993Q4 (T = 128). The file also holds 1961 and 1994, which we keep aside: 1961 supplies pre-sample lags, 1994 is the realization we will forecast.

No trend, and no seasonality because the series is seasonally adjusted. But it is highly serially correlated: it evolves slowly, high in booms and low in the recessions of the early 1980s and early 1990s.
## lag acf pacf Q p
## 1 1 0.949 0.949 118.05 0
## 2 2 0.877 -0.244 219.60 0
## 3 3 0.795 -0.100 303.65 0
## 4 4 0.707 -0.070 370.75 0
## 5 5 0.617 -0.066 422.20 0
## 6 6 0.526 -0.047 459.91 0
## 7 7 0.437 -0.031 486.23 0
## 8 8 0.351 -0.049 503.32 0
## 9 9 0.258 -0.151 512.62 0
## 10 10 0.163 -0.071 516.36 0
## 11 11 0.073 -0.010 517.12 0
## 12 12 -0.005 0.016 517.13 0
The two-standard-error band is 2/\sqrt{128} = 0.18. Each row’s Q uses the autocorrelations up to that displacement.
Gradual autocorrelation decay together with a partial autocorrelation function that cuts off at displacement 2 is a particular shape. Such shapes suggest candidate models, and
Diebold’s Figure 6.10. Dashed lines: \pm 2/\sqrt{T}.
feasts computes the same objects from a tsibble; gg_tsdisplay() draws series and correlogram in one call.
Many time series models can be easily written in the language of the lag operator L, which lags a series: L y_t = y_{t-1}, L^2 y_t = L(L y_t) = y_{t-2}, and L^m y_t = y_{t-m}.
Usually we operate with a polynomial in L,
B(L) = b_0 + b_1 L + b_2 L^2 + \cdots + b_m L^m ,
so that B(L) y_t = b_0 y_t + b_1 y_{t-1} + \cdots + b_m y_{t-m}, a weighted sum of current and past values called a distributed lag.
Most time series models contain distributed lags, because they say how the past evolves into the present. The notation is shorthand for stating and manipulating them.
The Durbin-Watson setting was a regression with serially correlated disturbances. Strip it to an intercept only:
y_t = \mu + \varepsilon_t, \qquad \varepsilon_t = \phi\, \varepsilon_{t-1} + v_t, \qquad v_t \sim \text{iid}(0, \sigma^2). \tag{1}
Lag equation (1) one period and multiply by \phi: \;\phi\, y_{t-1} = \phi\mu + \phi\, \varepsilon_{t-1}. Subtract from (1):
y_t - \phi\, y_{t-1} = \mu(1 - \phi) + (\varepsilon_t - \phi\, \varepsilon_{t-1}) \quad\Longleftrightarrow\quad y_t = \mu(1-\phi) + \phi\, y_{t-1} + v_t .
A regression with serially correlated disturbances and no lagged dependent variable is mathematically identical to one with a lagged dependent variable and iid disturbances. Each device mops up the serial correlation the other regressors leave behind; here there are no other regressors at all.
The first-order autoregressive process, AR(1), is
y_t = \phi\, y_{t-1} + \varepsilon_t, \qquad \varepsilon_t \sim WN(0, \sigma^2), \qquad\text{or}\qquad (1 - \phi L)\, y_t = \varepsilon_t .
A stochastic difference equation: the current value is a linear function of the previous value plus a shock.
set.seed(2); e <- rnorm(150) # one shock sequence for both
ar1 <- function(phi) as.numeric(stats::filter(e, phi, method = "recursive"))
d <- data.frame(t = rep(1:150, 2), phi = rep(c("phi = 0.4", "phi = 0.95"), each = 150),
y = c(ar1(0.4), ar1(0.95)))
ggplot(d, aes(t, y)) + geom_hline(yintercept = 0, colour = "grey40") + geom_line(colour = smu_blue) +
facet_wrap(~ phi, scales = "free_y") + labs(x = NULL, y = NULL)
Same shocks, different \phi. With \phi = 0.95 the fluctuations are far more persistent: the AR(1) can capture highly persistent dynamics with a single parameter.
The condition, for any autoregression: all roots of the autoregressive lag polynomial lie outside the unit circle. For the AR(1) the polynomial is 1 - \phi L, its root is L = 1/\phi, and |1/\phi| > 1 if and only if |\phi| < 1.
To see why, substitute backward for the lagged y:
y_t = \varepsilon_t + \phi\, y_{t-1} = \varepsilon_t + \phi\,\varepsilon_{t-1} + \phi^2 y_{t-2} = \cdots = \sum_{i=0}^{k-1} \phi^i \varepsilon_{t-i} + \phi^k y_{t-k} .
If |\phi| < 1 the last term vanishes as k \to \infty and we obtain the moving-average representation
y_t = \varepsilon_t + \phi\, \varepsilon_{t-1} + \phi^2 \varepsilon_{t-2} + \cdots = \sum_{i=0}^{\infty} \phi^i \varepsilon_{t-i} .
This is the Wold representation with b_i = \phi^i, absolutely summable. Ultimately the shocks are the only things that move y, so y can be written as a weighted history of shocks, with geometrically fading weights. If |\phi| \geq 1 the weights do not fade and no such representation exists.
From the moving-average representation, with \varepsilon uncorrelated across dates,
E(y_t) = \sum_{i=0}^{\infty} \phi^i E(\varepsilon_{t-i}) = 0, \qquad \operatorname{var}(y_t) = \sigma^2 + \phi^2\sigma^2 + \phi^4\sigma^2 + \cdots = \sigma^2 \sum_{i=0}^{\infty}\phi^{2i} = \frac{\sigma^2}{1 - \phi^2} .
Conditional on the past, from the process itself,
E(y_t \mid y_{t-1}) = \phi\, E(y_{t-1} \mid y_{t-1}) + E(\varepsilon_t \mid y_{t-1}) = \phi\, y_{t-1}, \qquad \operatorname{var}(y_t \mid y_{t-1}) = \phi^2 \cdot 0 + \sigma^2 = \sigma^2 .
With an intercept, y_t = c + \phi\, y_{t-1} + \varepsilon_t, the mean is \mu = c/(1-\phi) and everything else goes through for y_t - \mu.
Multiply the process by y_{t-\tau} and take expectations:
y_t\, y_{t-\tau} = \phi\, y_{t-1}\, y_{t-\tau} + \varepsilon_t\, y_{t-\tau} \quad\Longrightarrow\quad \gamma(\tau) = \phi\, \gamma(\tau - 1), \qquad \tau \geq 1,
because \varepsilon_t is uncorrelated with everything before t, so E(\varepsilon_t y_{t-\tau}) = 0 for \tau \geq 1.
A recursion: given \gamma(\tau) it delivers \gamma(\tau + 1). The initial condition is the variance we just computed, \gamma(0) = \sigma^2/(1-\phi^2), so
\gamma(\tau) = \phi^\tau \frac{\sigma^2}{1 - \phi^2}, \qquad \rho(\tau) = \phi^\tau, \qquad \tau = 0, 1, 2, \ldots

Diebold’s Figures 6.12 to 6.15. Persistence is far stronger at \phi = 0.95; both PACFs cut off after displacement 1.
The p-th order autoregressive process is
y_t = \phi_1 y_{t-1} + \phi_2 y_{t-2} + \cdots + \phi_p y_{t-p} + \varepsilon_t, \qquad \varepsilon_t \sim WN(0, \sigma^2),
or \Phi(L)\, y_t = (1 - \phi_1 L - \phi_2 L^2 - \cdots - \phi_p L^p)\, y_t = \varepsilon_t.
Its properties parallel the AR(1) case, and we state them without derivation:
The Canadian employment correlogram, gradual decay with a PACF cutoff at 2, is therefore the fingerprint of an AR(2).
Multiply y_t = \phi_1 y_{t-1} + \phi_2 y_{t-2} + \varepsilon_t by y_{t-\tau} and take expectations:
\gamma(\tau) - \phi_1\gamma(\tau-1) - \phi_2\gamma(\tau-2) = \begin{cases} \sigma^2, & \tau = 0 \\ 0, & \tau \geq 1 . \end{cases}
Dividing by \gamma(0) gives the whole autocorrelation function recursively:
\rho(1) = \frac{\phi_1}{1 - \phi_2}, \qquad \rho(\tau) = \phi_1 \rho(\tau-1) + \phi_2 \rho(\tau-2), \quad \tau = 2, 3, \ldots
The equations for \tau = 1, 2 can also be solved the other way, for the parameters given the autocovariances:
\phi_1 = \frac{\gamma(0)\gamma(1) - \gamma(1)\gamma(2)}{\gamma(0)^2 - \gamma(1)^2}, \qquad \phi_2 = \frac{\gamma(0)\gamma(2) - \gamma(1)^2}{\gamma(0)^2 - \gamma(1)^2} .
Replacing \gamma by \hat\gamma gives the Yule-Walker estimator. We will use OLS instead, but the idea that autocovariances identify the parameters is worth keeping.
In the AR(1), oscillation needs \phi < 0 and flips sign every period. Higher-order autoregressions can oscillate with longer, smoother periods, reminiscent of cycles in the traditional sense. That happens when some roots of \Phi(L) are complex. Take
y_t = 1.5\, y_{t-1} - 0.9\, y_{t-2} + \varepsilon_t, \qquad \Phi(L) = 1 - 1.5L + 0.9L^2 .
## [1] 0.8333333+0.6454972i 0.8333333-0.6454972i
## [1] 0.9486833 0.9486833
## [1] 9.533584
The inverse roots 0.75 \pm 0.58i have modulus 0.95: stationary, but close to the boundary, so the oscillation damps slowly, with a period of about nine and a half quarters.

Diebold’s Figure 6.16. The autocorrelation function oscillates with the period computed on the previous slide, and the PACF still cuts off at 2.
The sum of squares of an AR(p) is linear in the parameters, so estimation is an ordinary least squares regression of y_t on y_{t-1}, \ldots, y_{t-p} (and a constant). Nothing new to learn.
Build the lags on the full file, then restrict to 1962Q1 to 1993Q4. The lags of the first observations are the 1961 values, so every model below has T = 128.
est <- emp |>
mutate(L1 = lag(Employment), L2 = lag(Employment, 2), L3 = lag(Employment, 3), L4 = lag(Employment, 4)) |>
filter(Quarter >= yearquarter("1962 Q1"), Quarter <= yearquarter("1993 Q4"))
ar <- list(`AR(1)` = lm(Employment ~ L1, data = est),
`AR(2)` = lm(Employment ~ L1 + L2, data = est),
`AR(3)` = lm(Employment ~ L1 + L2 + L3, data = est),
`AR(4)` = lm(Employment ~ L1 + L2 + L3 + L4, data = est))
round(t(sapply(ar, fit_stats)), 4)## R2 SER DW AIC SIC
## AR(1) 0.9524 1.6424 1.0615 1.0078 1.0524
## AR(2) 0.9634 1.4467 2.0670 0.7617 0.8285
## AR(3) 0.9636 1.4487 2.0017 0.7721 0.8613
## AR(4) 0.9636 1.4542 2.0011 0.7872 0.8987
Both AIC and SIC pick the AR(2), in agreement with the correlogram. The third and fourth lags lower the sum of squares by almost nothing and pay a penalty for it.
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.8108 1.7281 2.2051 0.0293
## L1 1.4388 0.0785 18.3319 0.0000
## L2 -0.4765 0.0779 -6.1160 0.0000
## mean inverse_roots1 inverse_roots2
## 101.2412730 0.9221189 0.5166914

Diebold’s Figure 6.17b. The residuals look like white noise: no runs, no drift, one large positive shock in 1987.
Is what is left over white noise? Two parameters were estimated, so the Q statistics are compared with \chi^2_{m-2} and there is no p-value until m > 2.
## lag acf pacf Q p
## 1 1 -0.035 -0.035 0.16 NA
## 2 2 0.044 0.042 0.41 NA
## 3 3 0.011 0.014 0.43 0.5124
## 4 4 0.051 0.050 0.78 0.6775
## 5 5 0.002 0.004 0.78 0.8545
## 6 6 0.019 0.015 0.83 0.9348
## 7 7 -0.024 -0.024 0.90 0.9700
## 8 8 0.078 0.072 1.74 0.9421
## 9 9 0.080 0.087 2.62 0.9175
## 10 10 0.050 0.050 2.97 0.9361
## 11 11 -0.023 -0.027 3.05 0.9623
## 12 12 -0.129 -0.148 5.44 0.8600
Every autocorrelation is inside \pm 0.18 and every p-value is large. The AR(2) has extracted all the linear dynamics.
AR() in fable fits the same OLS regression. It drops the first p observations of whatever data it is given, so hand it the two 1961Q3 to 1961Q4 quarters as well to reproduce the estimates above exactly.
## # A tibble: 3 × 6
## .model term estimate std.error statistic p.value
## <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 ar2 constant 3.81 1.71 2.23 2.74e- 2
## 2 ar2 ar1 1.44 0.0776 18.6 5.80e-38
## 3 ar2 ar2 -0.476 0.0770 -6.19 7.70e- 9
order(1:4) with ic = "bic" (or "aic") performs the selection of the previous slides:
Recall four ways out of the forecasting-the-right-hand-side-variables problem. Deterministic regressors were the fourth. The third was lagged regressors:
y_t = \beta_1 + \beta_2\, x_{t-1} + \varepsilon_t \tag{2}
is immediately usable one step ahead, because the regressor for y_{T+1} is x_T, already observed. More lags are fine; the key is that everything on the right is lagged at least one period.
For h steps ahead, model (2) seems to bring the problem back: we would need x_{T+h-1}, so everything on the right would have to be lagged by h periods, not one.
For autoregressions the problem dissolves. A model with y_t on y_{t-1} can be turned into a model with y_t on y_{t-h}, mechanically, for any h. That is Wold’s chain rule.
The time-T information set is the observed history, \Omega_T = \{y_T, y_{T-1}, y_{T-2}, \ldots\}, imagined for theory as extending into the infinite past.
Under quadratic loss the optimal forecast of y_{T+h} is the conditional mean E(y_{T+h} \mid \Omega_T). In general it need not be a linear function of the elements of \Omega_T.
Linear functions are tractable, so we work with the best linear approximation to the conditional mean, the linear projection P(y_{T+h} \mid \Omega_T): the “linear least squares forecast”. Often it is very close to the conditional mean, and in the Gaussian case the two coincide exactly:
E(y_{T+h} \mid \Omega_T) = P(y_{T+h} \mid \Omega_T).
Notation for what follows: y_{T+h,T} is the h-step-ahead forecast made at T, what Lecture 4 wrote as \hat y_{T+h \mid T}.
Take y_t = \phi\, y_{t-1} + \varepsilon_t and build the forecasts one horizon at a time.
One step. Write the process at T+1 and project the right-hand side on \Omega_T:
y_{T+1} = \phi\, y_T + \varepsilon_{T+1} \quad\Longrightarrow\quad y_{T+1,T} = \phi\, y_T .
The future shock is replaced by its projection, 0; y_T is known.
Two steps. Write the process at T+2 and project on \Omega_T:
y_{T+2} = \phi\, y_{T+1} + \varepsilon_{T+2} \quad\Longrightarrow\quad y_{T+2,T} = \phi\, y_{T+1,T} = \phi^2 y_T .
The unknown y_{T+1} is replaced by the forecast we have just constructed.
Three steps likewise gives y_{T+3,T} = \phi\, y_{T+2,T} = \phi^3 y_T, and in general
y_{T+h,T} = \phi^h\, y_T \;\longrightarrow\; 0 \quad \text{as } h \to \infty .
The forecast reverts geometrically to the unconditional mean. With an intercept, y_{T+h,T} = c + \phi\, y_{T+h-1,T} \to \mu = c/(1-\phi).
The same recursion works for any order: write the process at T+h, replace future shocks by 0 and future y’s by their already-computed forecasts,
y_{T+h,T} = c + \phi_1\, y_{T+h-1,T} + \cdots + \phi_p\, y_{T+h-p,T}, \qquad y_{s,T} = y_s \text{ for } s \leq T .
Only the p most recent observations are ever needed, at any horizon. The FRV problem is solved for autoregressions, as it was for cross sections, trends and seasonals.
In truth the parameters are unknown, so we insert the OLS estimates to obtain operational forecasts. The recursion is six lines of R:
# coef = c(c, phi_1, ..., phi_p); y_last = the last p observations, oldest first
chain_rule <- function(coef, y_last, h) {
p <- length(coef) - 1; path <- y_last; f <- numeric(h)
for (i in 1:h) {
f[i] <- coef[1] + sum(coef[-1] * rev(tail(path, p))) # phi_1 * most recent, phi_2 * the one before, ...
path <- c(path, f[i]) # the forecast joins the history
}
f
}The chain rule delivers point forecasts. For interval and density forecasts we need the h-step forecast error variance \sigma_h^2 = \operatorname{var}(y_{T+h} \mid \Omega_T). For the AR(1):
Errors. Subtract the forecast from the outcome and use the moving-average representation:
e_{T+1,T} = \varepsilon_{T+1}, \qquad e_{T+2,T} = \varepsilon_{T+2} + \phi\, \varepsilon_{T+1}, \qquad e_{T+h,T} = \varepsilon_{T+h} + \phi\, \varepsilon_{T+h-1} + \cdots + \phi^{h-1} \varepsilon_{T+1} .
Variances. The shocks are uncorrelated, so
\sigma_1^2 = \sigma^2, \qquad \sigma_2^2 = \sigma^2(1 + \phi^2), \qquad \sigma_h^2 = \sigma^2 \sum_{i=0}^{h-1} \phi^{2i} \;\longrightarrow\; \frac{\sigma^2}{1 - \phi^2} \quad \text{as } h \to \infty .
The limit is the unconditional variance of the process: conditioning information loses its value as the horizon grows, until the forecast is no better than the unconditional mean.
Under normality, y_{T+h} \mid \Omega_T \sim N(y_{T+h,T}, \sigma_h^2) is the density forecast, and y_{T+h,T} \pm 1.96\, \sigma_h the 95% interval.
For an AR(p) the error is again a weighted sum of the future shocks, e_{T+h,T} = \sum_{i=0}^{h-1} \psi_i\, \varepsilon_{T+h-i}, where the \psi_i are the coefficients of the process’s moving-average representation y_t = \mu + \sum_i \psi_i \varepsilon_{t-i}. They follow from the AR coefficients by the recursion
\psi_0 = 1, \qquad \psi_j = \sum_{i=1}^{\min(j, p)} \phi_i\, \psi_{j-i}, \qquad \sigma_h^2 = \sigma^2 \sum_{i=0}^{h-1} \psi_i^2 .
For p = 1 this gives \psi_i = \phi^i, as before.
Two things the formula ignores. Parameter estimation error, which can make \sigma_h^2 grow without bound rather than converge. And non-normality, which simulation handles without any variance calculation.
The best autoregression was the AR(2). Its last two observations are 1993Q3 and 1993Q4; feed them to the chain rule and scale the \psi weights by the SER.
## point se lower upper
## 1 88.83 1.45 85.99 91.66
## 2 89.52 2.53 84.55 94.49
## 3 90.29 3.43 83.57 97.00
## 4 91.07 4.14 82.95 99.18
The point forecast climbs slowly from the last observation (88.4) toward the mean (101.2) and is still far below it after four quarters. The standard error grows from the SER to nearly three times the SER, and the bands are nowhere near their long-run width. Both reflect the persistence the AR(2) captured.

Diebold’s Figure 6.20. History 1990Q1 to 1993Q4, then the four-quarter forecast (blue) with its 95% interval.

## [1] 1.279815
The forecast tracks the recovery well: the realization (red) sits close to the point forecast and well inside the band, with a mean squared error of 1.3, less than the SER squared.
Diebold’s Figure 6.21.

Eventually the forecast reaches the unconditional mean (dotted) and the bands go flat at \pm 1.96 \times 7.3, the standard deviation the model implies (the sample standard deviation is 7.5). But only after many years: high persistence means a long memory.
Diebold’s Figures 6.22 and 6.23.
## # A tsibble: 4 x 3 [1Q]
## Quarter .mean `95%`
## <qtr> <dbl> <hilo>
## 1 1994 Q1 88.8 [86.02621, 91.63018]95
## 2 1994 Q2 89.5 [84.60804, 94.42726]95
## 3 1994 Q3 90.3 [83.65073, 96.92412]95
## 4 1994 Q4 91.1 [83.04561, 99.08737]95

fable estimates \sigma^2 by SSR/T rather than SSR/(T-k), so its intervals are about one percent narrower.
library(fpp3)
# ---- correlogram ----------------------------------------------------------------
acf(y, lag.max = 12); pacf(y, lag.max = 12) # base R (divide-by-T estimator)
Box.test(y, lag = 12, type = "Ljung-Box") # Q test; fitdf = k for residuals
correlogram(y, m = 12, dof = 0) # table of acf, pacf, Q, p (defined in these slides)
tsb |> gg_tsdisplay(y, plot_type = "partial") # series + ACF + PACF, fpp3
tsb |> features(y, ljung_box, lag = 12, dof = 0) # Ljung-Box, fpp3
# ---- autoregressions ------------------------------------------------------------
tsb <- tsb |> mutate(L1 = lag(y), L2 = lag(y, 2)) # build lags, then filter to the sample
lm(y ~ L1 + L2, data = tsb); fit_stats(fit) # OLS; R2, SER, DW, AIC, SIC
Mod(1 / polyroot(c(1, -coef(fit)[-1]))) # inverse roots: < 1 means stationary
tsb |> model(AR(y ~ order(2))) # fable; order(1:4), ic = "bic" to select
lmtest::bgtest(fit, order = 4) # Breusch-Godfrey residual test
# ---- forecasts ------------------------------------------------------------------
chain_rule(coef(fit), tail(y, p), h) # point forecasts by Wold's chain rule
sigma(fit) * sqrt(cumsum(psi_weights(coef(fit)[-1], h)^2)) # h-step standard errors
model(tsb, AR(y ~ order(2))) |> forecast(h = 4) |> hilo(95) # the same in fable
arima.sim(n = 200, list(ar = c(0.5, 0.3))) # simulate an AR processdata/caemp.csv: seasonally adjusted Canadian employment index, 1961Q1 to 1994Q4, from the companion files. data/GDPC1.csv: US real GDP from FRED, as in Lecture 6.