QTQuant Terminal
D1-05D1·intermediate·~18 min

MA and ARMA — shocks with echoes, and an honest scoreboard

time-seriesma-modelsarmaacf-signaturesmodel-identification

▸ Pretest — guess, even if you don't know

You fit an ARMA model to ten years of daily S&P 500 returns. The fit converges nicely. What should you expect from its out-of-sample forecasts?

MA(1): a shock with an echo

The moving-average model of order one (take the mean as zero for simplicity):

xt=εt+θεt1x_t = \varepsilon_t + \theta\, \varepsilon_{t-1}

Read it as news dynamics: a fresh shock εt\varepsilon_t hits today, and yesterday's shock echoes exactly once, scaled by θ\theta — then it is gone forever. Contrast this with AR(1) from D1-04, where a shock enters the level and echoes forever with geometric fading. The trading question MA answers: what does a market look like where events matter briefly and then fully stop mattering? One concrete habitat: bid-ask bounce induces MA(1)-like negative lag-1 autocorrelation in high-frequency returns — trades ping-ponging between bid and ask create one-period echoes with no real price change behind them.

The MA(1) autocorrelation function can be worked out directly: only adjacent terms share a shock, so

ρ1=θ1+θ2,ρk=0    for k2\rho_1 = \frac{\theta}{1 + \theta^2}, \qquad \rho_k = 0 \;\; \text{for } k \ge 2

For θ=0.5\theta = 0.5, ρ1=0.5/1.25=0.4\rho_1 = 0.5/1.25 = 0.4; the largest lag-1 autocorrelation any MA(1) can produce is 0.50.5, at θ=1\theta = 1. Note the hard cutoff: beyond lag 1, exactly zero.

Reading ACF signatures

That cutoff is the identification heuristic of the whole Box–Jenkins tradition. Given a stationary series, look at its ACF (D1-01):

(The partial ACF, which statsmodels plots alongside, does the mirror image: it cuts off at pp for AR models. The pair of plots is the classic order-picking tool.) The ±2/N\pm 2/\sqrt{N} band from D1-01 is what "drops to zero" means in practice — this is where that eyeball rule earns its keep.

ARMA: both kinds of memory

Real series often carry both a persistent component and short echoes, so combine them — ARMA(p,qp, q):

xt=c+i=1pϕixti+εt+j=1qθjεtjx_t = c + \sum_{i=1}^{p} \phi_i\, x_{t-i} + \varepsilon_t + \sum_{j=1}^{q} \theta_j\, \varepsilon_{t-j}

The practical selling point is parsimony: an ARMA(1,1) often fits what a pure AR would need five lags to approximate, and fewer parameters means less overfitting (the D4-01 lesson, in model-order clothing). Fitting is no longer plain OLS — the past shocks are unobserved — so use a library (display only; the exercise runtime here is numpy-only):

from statsmodels.tsa.arima.model import ARIMA
fit = ARIMA(x, order=(1, 0, 1)).fit()   # ARMA(1,1); middle 0 = no differencing

The middle number is dd, the number of differences to take first — set it to 1 and the model differences a non-stationary series for you, which is exactly the D1-03 recipe automated (the "I" in ARIMA is "integrated").

The honest scoreboard

Where does this machinery actually make money? Time for the track's most valuable table:

Same tool, three habitats, one lesson: the model does not create predictability — it can only harvest autocorrelation that is already there. Check the ACF first; it tells you whether there is anything to model before you model it.

Try it

▮ EXERCISE · d1-05-ex1

Implement ma1_series(eps, theta): build the MA(1) process from an array of shocks. The first element is eps[0] (the shock before it is treated as zero), and every later element t equals eps[t] plus theta times the previous shock eps[t-1].

⧉ Review card
Write the MA(1) model and give its intuition versus AR(1).
x_t = shock_t + theta times shock_(t-1): each shock hits once and echoes exactly once, then stops mattering. AR(1) is the opposite temperament — a shock enters the level and echoes forever with geometric fading.
⧉ Review card
What are the ACF signatures that identify AR versus MA models?
AR(p): the ACF decays geometrically and never cleanly stops. MA(q): the ACF cuts off hard after lag q — exactly zero beyond it in theory, inside the 2-over-root-N band in practice. The PACF mirrors this, cutting off at p for AR models.
⧉ Review card
What is the lag-1 autocorrelation of an MA(1), and its maximum?
rho_1 = theta over (1 + theta squared), and zero at all lags beyond 1. For theta = 0.5 that gives 0.4; the maximum possible is 0.5, reached at theta = 1. No MA(1) can produce lag-1 autocorrelation above one half.
⧉ Review card
Where do ARMA models fail and where do they earn their keep in trading?
On daily returns they find approximately nothing — competition strips linear structure, coefficients are tiny and unstable, costs eat the rest. They earn their keep on stationary series with real memory: spreads (the pairs-trading model) and volatility (strongly autocorrelated, the gateway to GARCH).

Summarize it

Close the linear-models arc. In six sentences, written or spoken, summarize D1-01 through D1-05: what autocorrelation measures, what white noise and the random walk are null models for, why stationarity is the license to estimate anything, what kind of memory AR captures versus MA, and — final sentence — where in actual trading each piece of this machinery earns money and where it finds nothing.

Predict before the next lesson

Next: model selection and forecasting (D1-06). You now have a whole family of models — AR(1), AR(2), MA(1), ARMA(1,1), and upward. Before then, predict: if you fit every one of them to the same series, which will have the best in-sample fit, and why is that answer useless for picking the model you should actually trade?

◈ Calibration check

Could you sketch the ACF of an AR(1) versus an MA(1) from memory, compute rho_1 for a given theta, and explain to a skeptic why ARMA on daily returns finds nothing while ARMA on volatility works?

1 = guessing · 5 = could teach it

⏻ End of lesson

Mark it read to book its 4 review cards into your deck.

Sources & further reading