Quant Memo
Core

Cointegration

When two non-stationary series share a common stochastic trend so a linear combination is stationary, the Engle–Granger and Johansen tests, the error-correction representation, and the econometric foundation of pairs trading.

Prerequisites: Unit Roots and the ADF Test, Stationarity

Cointegration is the precise idea behind "these two prices move together." Individually, two asset prices are non-stationary random walks, regressing one on the other is the spurious-regression trap. But sometimes a specific linear combination of them is stationary: they share a common stochastic trend that cancels, and the spread between them mean-reverts. That stationary spread is a tradable, statistically-founded signal, and cointegration is the econometrics that tells you whether it is real. It is the theoretical spine of Pairs Trading and statistical arbitrage.

The definition

Two series xtx_t and yty_t that are each integrated of order one, I(1)I(1) (unit roots, non-stationary), are cointegrated if there exists a constant β\beta, the cointegrating coefficient, such that the linear combination

zt=ytβxt  I(0)z_t = y_t - \beta x_t \ \sim\ I(0)

is stationary. The vector (1,β)(1, -\beta) is the cointegrating vector. The content of the definition: differencing normally takes I(1)I(1) to I(0)I(0), but here a particular weighted level combination is already stationary without differencing. Economically, xx and yy are each driven by the same underlying random-walk factor (a common trend), and the cointegrating combination nets it out, leaving only stationary, mean-reverting noise, the spread. Generically a combination of two random walks is another random walk; cointegration is the special, testable case where it collapses to stationarity.

Why this rescues you from spurious regression

Recall that regressing I(1)I(1) on I(1)I(1) usually manufactures fake significance (see Unit Roots and the ADF Test). Cointegration is the one legitimate exception: if the two series are genuinely cointegrated, the levels regression yt=α+βxt+zty_t = \alpha + \beta x_t + z_t is not spurious, it is estimating the true long-run relationship, and OLS on the levels is in fact super-consistent (it converges to β\beta at rate nn rather than n\sqrt n). The whole game is therefore to test whether the residual ztz_t is stationary before trusting the regression.

Engle–Granger: the two-step test

The intuitive procedure:

  1. Estimate the cointegrating relationship by OLS in levels, yt=α+β^xt+z^ty_t = \alpha + \hat\beta x_t + \hat z_t, and keep the residuals z^t\hat z_t.
  2. Test the residuals for a unit root with an ADF test. If z^t\hat z_t is stationary (reject the unit-root null), the series are cointegrated; if z^t\hat z_t has a unit root, they are not, you are back in spurious-regression land.

The catch: because z^t\hat z_t is a fitted residual (the coefficient was estimated to make it look as stationary as possible), the ordinary ADF critical values are wrong, you must use the more conservative Engle–Granger / MacKinnon critical values. Engle–Granger is simple and transparent but has two weaknesses: it is asymmetric (regressing yy on xx vs xx on yy can disagree in finite samples) and it finds at most one cointegrating relationship.

Johansen: the multivariate test

For a system of k>2k > 2 series, there can be up to k1k-1 independent cointegrating vectors, and the Johansen procedure handles this properly. It is a maximum-likelihood test built on the vector error-correction model

Δyt=Πyt1+iΓiΔyti+εt,\Delta \mathbf{y}_t = \Pi\,\mathbf{y}_{t-1} + \sum_{i}\Gamma_i\,\Delta\mathbf{y}_{t-i} + \varepsilon_t,

where the rank of Π\Pi equals the number of cointegrating relationships. Rank 0 means no cointegration (difference everything); full rank means the levels were stationary to begin with; intermediate rank rr means rr cointegrating vectors, recovered from the eigenvectors of Π\Pi. Johansen's trace and maximum-eigenvalue statistics test the rank sequentially. It is symmetric, estimates all cointegrating vectors at once, and is the professional default for baskets of more than two assets.

The error-correction representation

The Granger representation theorem delivers the punchline for trading: if xt,ytx_t, y_t are cointegrated, their dynamics have an equivalent error-correction model (ECM):

Δyt=γ(yt1βxt1)zt1+(lagged Δ terms)+εt,γ<0.\Delta y_t = \gamma\,\underbrace{(y_{t-1} - \beta x_{t-1})}_{z_{t-1}} + (\text{lagged } \Delta\text{ terms}) + \varepsilon_t, \qquad \gamma < 0.

The term γzt1\gamma z_{t-1} is the error-correction term: when the spread zt1z_{t-1} is above its equilibrium (too wide), the negative γ\gamma pushes Δyt\Delta y_t down, pulling the system back. This is mean reversion made mechanical, γ\gamma is the speed of adjustment, and its half-life log(0.5)/log(1+γ)\log(0.5)/\log(1+\gamma) is precisely the horizon over which a pairs trade is expected to converge. Cointegration guarantees this restoring force exists; the ECM quantifies it.

Worked example: a pairs trade

Two refiners, AA and BB, both have I(1)I(1) prices. Regress logPtA\log P^A_t on logPtB\log P^B_t: β^=1.2\hat\beta = 1.2, and the ADF test on the residual spread zt=logPtA1.2logPtBz_t = \log P^A_t - 1.2\log P^B_t rejects the unit root at the Engle–Granger critical value, they are cointegrated, hedge ratio 1.21.2. You standardize the spread to a z-score; when ztz_t is +2σ+2\sigma (A rich vs B), short AA / long 1.21.2 units of BB, betting the error-correction force pulls the spread back to zero; unwind at zt0z_t \approx 0. The ECM speed of adjustment sets your expected holding period and thus your capacity and turnover. This is textbook statistical arbitrage, and its Achilles heel is that cointegration estimated on history can break, which is where refiners' relationship snaps when one gets acquired or re-hedges its crude exposure. See Mean Reversion and Pairs Trading.

Failure modes in financial data

  • Cointegration breaks. The most dangerous failure: a pair cointegrated for years decouples (M&A, index reconstitution, a regime change), and the "mean-reverting" spread trends away, the trade that was supposed to converge blows through your stop. Cointegration is not a law of nature; it is an estimated, non-stationary property.
  • Look-ahead and in-sample bias. Selecting pairs by best in-sample cointegration over thousands of candidates is massive multiple testing (see p-values and Multiple Testing); most "cointegrated" pairs are false discoveries that fail out of sample.
  • Unstable hedge ratio. β^\hat\beta drifts over time; a fixed ratio estimated on old data mis-hedges. Rolling or Kalman-filtered estimation helps but adds its own instability.
  • Correlation is not cointegration. Two series can be highly correlated in returns yet not cointegrated (no stable long-run level relationship), and vice versa, trading a spread on correlation alone lacks the restoring force.

In interviews

Define cointegration exactly: two (or more) I(1)I(1) series whose linear combination ytβxty_t - \beta x_t is I(0)I(0), sharing a common stochastic trend. Explain why it is the legitimate exception to spurious regression (and mention super-consistency if pressed). Walk through Engle–Granger, OLS in levels, then ADF on the residuals with adjusted critical values, and know that Johansen generalizes it to multiple series via the rank of Π\Pi and estimates all cointegrating vectors symmetrically. The connection interviewers want is the error-correction model: cointegration ⇒ an ECM with a negative speed-of-adjustment on the lagged spread, which is mechanical mean reversion and the basis of pairs trading. Close with the practical warning, the relationship can break, and pair selection is a multiple-testing minefield.

Related concepts

Practice in interviews

Further reading

  • Engle & Granger (1987), Co-integration and Error Correction
  • Johansen (1991), Estimation and Hypothesis Testing of Cointegration Vectors
  • Hamilton, Time Series Analysis (Ch. 19)
ShareTwitterLinkedIn