Day 78 — Cointegration, and the error correction model

Friday, 23 October 2026 · Week 12 of 52 · Time series · Study day · 65 min

This is the structure that pairs trading actually relies on, and it is the one case where regressing one price on another is not the mistake week 11 warned you about.

What you should be able to do tonight

  • Explain cointegration in three sentences to someone who knows regression but not time series.
  • Write the error correction representation of a cointegrated pair and say which coefficient is the trade.

Tasks 65 min

25 min Read the Avellaneda and Lee statistical arbitrage paper’s model section, where the residual spread is treated as a mean-reverting process. Skip the empirical results; you are after the framing.

25 min Run Engle-Granger by hand rather than by function call: regress one log price on the other, take the residual, and run ADF on it with the correct critical values, which are not the standard ones because the residual came from an estimated relationship. Report both pairs.

15 min Write the error correction form: the change in each price regressed on the lagged residual and on lagged changes. The coefficient on the lagged residual is the speed at which the gap closes and the sign tells you which leg does the adjusting, which is the whole trade in one number.

Resources

Deliverable

notebooks/day-078-engle-granger.ipynb with the two-stage procedure run by hand and the error correction representation estimated for both pairs.

Checkpoint

Why do the second-stage ADF critical values differ from the standard ones, and what does the error correction coefficient tell you?

Prepare for tomorrow

Ten minutes tonight so Day 79, Saturday, 24 October 2026 starts clean. This is what the evening email sends you.

Generate 200 pairs of independent random walks and save them. Tomorrow you run your own screen on them.

Write down what fraction you expect to pass a 5 percent cointegration test.

Keep the number; the gap between it and the answer is tomorrow’s result.