Cointegration: when two non-stationary series share a stationary spread
Two stock prices each wander randomly. Their *combination* $X - \beta Y$ can be stationary, giving you a mean-reverting spread to trade. Engle-Granger's 1987 procedure makes the test mechanical.
Two stock prices look like random walks (unit-root, non-stationary), so neither is mean-reverting and you cannot fade them individually. But a linear combination $Z_t = X_t - \beta Y_t$ can be stationary for some $\beta$ — the cointegrating coefficient. When this happens the spread itself is the tradeable object: it wanders away from its mean, then snaps back, repeatedly. This is the workhorse of statistical-arbitrage pairs trading. The Engle-Granger (1987) procedure tests it in two steps: estimate $\beta$ via OLS on the levels, then test the residuals for stationarity via Dickey-Fuller. Pass: tradeable. Fail: the relationship was spurious, and you almost just lost money.
β Intro Β· expand
Try first (productive failure)
Before the worked example: spend 60 seconds taking your best shot at this.
A guess is fine β being briefly wrong about a problem makes the explanation
land harder when you read it. This appears once per tutorial; skip
if you already know the trick.
60s
β Try first Β· expand
Worked example
You have $T = 200$ daily closes of two unit-root series $X_t$ and $Y_t$. Sample means are $\bar X = 105$, $\bar Y = 50$; sample variance of $Y$ is $5$; sample covariance is $10$. Estimate the Engle-Granger cointegrating coefficient $\beta$ and the intercept $\alpha$. If a subsequent AR(1) fit on the residuals gives $\hat\phi = 0.7$, what is the spread's half-life?
β Worked example Β· expand
Practice 1 of 3Type a fraction, decimal, or expression β mathjs parses it.
β Practice Β· expand
Reflection
Spurious regression has a t-statistic that grows with sample size even when nothing is there. Why doesn't an Engle-Granger residual stationarity test have the same problem — what is structurally different about it?