MA models and the ACF cutoff
The question
Two weights on past shocks: can you make the autocorrelation ≈ 0.54 at lag 1, ≈ 0.21 at lag 2, and 0 after?
Move two sliders, match the bars, then compare with an AR(1).
- 1 SeeMatch a target ACF with two weights.
- 2 TryProbe one weight, then read one record.
- 3 ProveBuild the proof, line by line.
- 4 ApplyRolling returns, bid-ask spreads and more.
Before you start · 3 quick checks on autocorrelation, a variance and the AR(1), about 3 min
Two ideas before you start
2 ideasEach reading is a weighted sum of recent shocks
Figure: twelve shocks as thin bars and the readings built from them as a dashed line. It needs JavaScript.
Xₜ = εₜ + 0.8 εₜ₋₁
The thin bars are shocks: new, unpredictable pieces of noise. Each reading, on the dashed line, adds the newest shock to θ times the one before; with θ = 0 the readings are the shocks themselves.
Exact definition
White noise. A sequence \((\varepsilon_t)\) at integer times is white noise with variance \(\sigma^2 \gt 0\) if \(\operatorname{E}[\varepsilon_t] = 0\), \(\operatorname{Var}(\varepsilon_t) = \sigma^2\) and \(\operatorname{Cov}(\varepsilon_s, \varepsilon_t) = 0\) for \(s \ne t\). The shocks need not be independent or normal.
MA(\(q\)) model. For an integer \(q \ge 1\), real weights \(\theta_1, \dots, \theta_q\) with \(\theta_q \ne 0\) and a real mean \(\mu\),
\[\begin{aligned} X_t &= \mu + \varepsilon_t + \theta_1\varepsilon_{t-1} \\ &\qquad + \dots + \theta_q\varepsilon_{t-q}. \end{aligned}\]It is a moving-average model of order \(q\). The MA(1) is \(X_t = \mu + \varepsilon_t + \theta\varepsilon_{t-1}\); the MA(2) adds the term \(\theta_2\varepsilon_{t-2}\). The card's figure uses fixed whole-number shocks \(\varepsilon_0, \dots, \varepsilon_{12}\), so that the arithmetic is easy to follow, and draws \(\varepsilon_1\) to \(\varepsilon_{12}\).
Readings share shocks only when they are close
Figure: a row of shocks, the three used by one reading and the three used by a reading k steps later, with the shared shocks shaded. It needs JavaScript.
Shared shocks: 2 γ(1) = σ²(θ₁ + θ₁θ₂)
In an MA(2), Xₜ uses the shocks at times t, t − 1 and t − 2 (solid bracket). A reading k steps later (dashed bracket) shares some of them only while k ≤ 2, and shared shocks are the only source of covariance.
Exact definition
Autocovariance and ACF. For a weakly stationary process, \(\gamma(k) = \operatorname{Cov}(X_t, X_{t+k})\) depends only on the lag \(k\), and the autocorrelation function (ACF) is \(\rho(k) = \gamma(k)/\gamma(0)\). The lessons on autocorrelation and stationarity define both.
The MA(2) values. With white-noise shocks of variance \(\sigma^2\),
\[\begin{aligned} \gamma(0) &= \sigma^2(1 + \theta_1^2 + \theta_2^2), \\ \gamma(1) &= \sigma^2(\theta_1 + \theta_1\theta_2), \\ \gamma(2) &= \sigma^2\theta_2, \end{aligned}\]and \(\gamma(k) = 0\) for every \(k \ge 3\). Stage 3 proves the general version for an MA(\(q\)).
Fine print: the name, the shocks and the mean
"Moving average" is a historical name. The weights \(\theta_i\) need not be positive and need not add up to 1, so \(X_t\) is usually not an average in the everyday sense.
Every exact statement about \(\gamma\) and \(\rho\) on this page uses only the white-noise assumptions: mean 0, a constant variance and no correlation between different times. The simulations in 2 Try use the stronger assumption of independent standard normal shocks. The mean \(\mu\) shifts every reading by the same constant and does not change any covariance.
Match a target ACF
- Move the weights θ₁ and θ₂. The narrow bars show the ACF of your MA(2) at once.
- Bring your bars at lags 1 and 2 within 0.02 of the shaded target bars, then press Check my match.
- After a match, the page sets an AR(1) with the same first bar next to yours.
How the bars are computed
Your model is the MA(2) with white-noise shocks of variance \(\sigma^2\):
\[\begin{aligned} X_t &= \mu + \varepsilon_t + \theta_1\varepsilon_{t-1} \\ &\qquad + \theta_2\varepsilon_{t-2}. \end{aligned}\]The bars are its exact ACF, from the formulas of the second idea card:
\[\begin{aligned} \rho(1) &= \frac{\theta_1 + \theta_1\theta_2}{1 + \theta_1^2 + \theta_2^2}, \\ \rho(2) &= \frac{\theta_2}{1 + \theta_1^2 + \theta_2^2}, \end{aligned}\]and \(\rho(k) = 0\) for \(k \ge 3\). Neither \(\sigma^2\) nor \(\mu\) changes them. The target bars are the ACF of one MA(2) whose weights are on the sliders' grid of 0.05.
Same first bar, two models
The AR(1) model \(X_t = \phi X_{t-1} + \varepsilon_t\), stationary with \(\lvert\phi\rvert \lt 1\), has \(\rho(k) = \phi^k\). Setting \(\phi\) equal to your \(\rho(1)\) gives it the same first bar as your MA(2).
| Lag k | Your MA(2): ρ(k) | AR(1): φᵏ |
|---|
One weight, then one record
A prediction first. The explorer below it opens once you check your answer.
Explorer: the lag-1 bar of an MA(1)
Goals
From the model to one record
Every bar so far was a model value \(\rho(k)\). A data analyst sees one finite record and computes its sample ACF \(r_k\), with the full-record formula of the autocorrelation lesson. Predict first; the simulator opens when you check.
Each path is one simulated record of the model of 1 See, with independent standard normal shocks and \(\mu = 0\). Path \(m\) comes from seed \(m\) of the page's random generator, and a shorter record is the start of a longer one. No path was picked to look good.
The band is approximate: Bartlett's formula holds for large \(n\), and even then about 1 bar in 20 past lag 2 should fall outside it. Larger \(n\) narrows the band in proportion to \(1/\sqrt{n}\).
Why the ACF stops at lag q
Assumptions. \((\varepsilon_t)\) is white noise at integer times: \(\operatorname{E}[\varepsilon_t] = 0\), \(\operatorname{Var}(\varepsilon_t) = \sigma^2 \gt 0\), and \(\operatorname{Cov}(\varepsilon_s, \varepsilon_t) = 0\) for \(s \ne t\). The order \(q \ge 1\) is an integer, \(\theta_0 = 1\), the weights \(\theta_1, \dots, \theta_q\) are real with \(\theta_q \ne 0\), \(\mu\) is real, and
\[X_t = \mu + \sum_{i=0}^{q} \theta_{i}\varepsilon_{t-i}.\]Write \(\gamma(k) = \operatorname{Cov}(X_t, X_{t+k})\) and \(\rho(k) = \gamma(k)/\gamma(0)\).
Conclusion. \(\operatorname{E}[X_t] = \mu\), and for every \(t\),
\[\begin{aligned} \gamma(0) &= \sigma^2\sum_{i=0}^{q} \theta_{i}^2, \\ \gamma(k) &= \sigma^2\sum_{i=0}^{q-k} \theta_{i}\theta_{i+k} \\ &\qquad (1 \le k \le q), \\ \gamma(k) &= 0 \quad (k \gt q). \end{aligned}\]So \((X_t)\) is weakly stationary, and since \(\gamma(q) = \sigma^2\theta_q \ne 0\), its ACF is nonzero at lag \(q\) and 0 at every lag beyond \(q\).
Facts the proof uses.
- Covariance is unchanged when a constant is added to either argument, and it is linear in each argument: \[\begin{aligned} &\operatorname{Cov}\Bigl(\sum_i a_iU_i, \sum_j b_jV_j\Bigr) \\ &= \sum_i\sum_j a_ib_j\operatorname{Cov}(U_i, V_j). \end{aligned}\]
- The variance of a sum of uncorrelated terms is the sum of their variances, and \(\operatorname{Var}(aU) = a^2\operatorname{Var}(U)\).
- \(\operatorname{E}[X_t] = \mu\) by linearity of expectation, since every \(\operatorname{E}[\varepsilon_{t-i}] = 0\).
Each option is one step of the proof. Pick the one that is true for every order \(q \ge 1\), all weights with \(\theta_q \ne 0\) and every \(\sigma \gt 0\).
Problems
Lines 1 and 4 of the proof give every model value you need; the explorers in 2 Try show the MA(1) curve and Bartlett's band.
Further reading
- G. E. P. Box, G. M. Jenkins, G. C. Reinsel and G. M. Ljung, Time Series Analysis: Forecasting and Control, 5th ed. (Wiley, 2015), chapter 3 on moving-average models and chapter 6 on identification with the ACF.
- P. J. Brockwell and R. A. Davis, Introduction to Time Series and Forecasting, 3rd ed. (Springer, 2016), chapters 2 and 3, including Bartlett's formula.
- R. Roll, "A simple implicit measure of the effective bid-ask spread in an efficient market," Journal of Finance 39 (1984), the bid-ask model of problem P3.