Log inStart free

Learn

The Engle–Granger and ADF tests explained for pairs traders

Almost every pairs trading screen rests on two tests: the augmented Dickey–Fuller (ADF) test and the Engle–Granger cointegration test. They are easy to run with one line of code and easy to misread.

What the ADF test asks

The ADF test asks whether a series has a unit root, which is the statistician's way of saying it behaves like a random walk with no pull back to any level. It fits a regression of the series' change on its own lagged level (plus a few lagged changes to soak up autocorrelation):

Δs(t) = c + γ · s(t−1) + Σ φᵢ · Δs(t−i) + ε

The null hypothesis is γ = 0: no mean reversion. A strongly negative test statistic, and so a small p-value, is evidence against the random walk. For a pairs trader, the series is the spread.

What Engle–Granger adds

The Engle–Granger method has two steps. First, estimate the hedge ratio with a regression of one price on the other. Second, run a unit-root test on the residuals of that regression. The twist is that the residuals were chosen by the regression to look as stationary as possible, so the ordinary ADF critical values are too lenient. Engle–Granger uses stricter critical values (MacKinnon's) that account for the estimated β. In Python, statsmodels.tsa.stattools.coint does both steps and returns the correct p-value; see pairs trading in Python.

Reading the p-value

Five common mistakes

  1. Ignoring multiple testing. Test 1,000 pairs and about 50 will pass at 5% by luck. Use q-values or another correction; see how to find cointegrated pairs.
  2. Using ADF critical values on Engle–Granger residuals. It overstates significance.
  3. Testing on the same data you trade. A pair selected because it passed over 2020–2023 will look great in a 2020–2023 backtest.
  4. Too short a window. With a few months of data, the tests have little power and their results swing from week to week.
  5. Treating a pass as a guarantee. Structural breaks, such as mergers or index changes, do not announce themselves in past data.

Johansen, briefly

The Johansen test handles more than two series at once and does not depend on which asset goes on the left of the regression. For simple pairs, Engle–Granger is easier to interpret and remains the most common choice.

See the tests on real pairs

Each of Arbitrading's pair pages shows the Engle–Granger p-value, the ADF p-value and the multiple-testing q-value, updated daily, for example GDX vs GDXJ. They describe past behaviour only.

Try Pro free for 14 days

More guides