TradeLabs AILearn

Cointegration

Cointegration means two non stationary series share a long run relationship. Learn the Engle Granger and Johansen tests, hedge ratios and pairs trading uses.

Advanced3 min readUpdated 3 Oct 2026
Markdown
Lesson 35 of 46

Two price series can each wander randomly, yet stay tied together over the long run. When a combination of them is stationary, they are said to be cointegrated. Think of a person walking a dog on a long lead: both wander, but they never drift too far apart. Cointegration is the statistical foundation of pairs trading and statistical arbitrage, because it identifies spreads that tend to revert to a stable level. Clive Granger and Robert Engle shared the 2003 Nobel Memorial Prize in Economic Sciences in part for their work on it.

The idea#

If prices X and Y are both non stationary, but there is a coefficient β such that

spread = Y - β × X

is stationary, then X and Y are cointegrated, and β is the cointegrating coefficient (the hedge ratio). See Stationarity, Differencing and Unit Roots.

Correlation vs cointegration#

CorrelationCointegration
MeasuresCo movement of returns, usually short termLong run relationship between price levels
Data usedReturnsPrices
High value meansReturns move togetherThe spread stays bounded and reverts
Trading useDiversification, hedgingPairs trading, spread trading

Two stocks can be highly correlated but not cointegrated, drifting apart over time. Two cointegrated stocks can have modest daily correlation but still be pulled back together. See Covariance and Correlation.

The Engle Granger test#

  1. Regress Y on X (in price levels) to estimate β.
  2. Calculate the residuals (the spread).
  3. Test the residuals for stationarity with an ADF test, using special critical values because β was estimated.

The Johansen test#

The Johansen test, developed by Søren Johansen, tests for cointegration among several series at once and can find more than one cointegrating relationship. It is used for baskets, such as a stock against several peers or a group of related futures contracts. See Statistical Arbitrage.

Error correction models#

Cointegrated series can be modelled with an error correction model, where today's changes depend on how far the spread is from equilibrium:

ΔY_t = α × (Y_(t-1) - β X_(t-1)) + other terms + ε_t

A negative α means deviations shrink over time; its size shows how quickly. See Econometrics.

Practical issues#

IssueExplanation
Relationships breakMergers, business changes or regulation can end cointegration
Look ahead biasEstimating β on the full sample then trading in the same period inflates results. See Look-Ahead Bias
Multiple testingTesting thousands of pairs finds some cointegrated pairs by chance. See P-Hacking and Multiple Testing
Unstable hedge ratiosβ can drift; rolling estimates or Kalman filters help
Costs and shortingBorrow fees and trading costs eat small edges. See Borrow Fees and Stock Loan Costs

Good candidates for cointegration#

  • Companies with similar businesses and exposures, such as two large banks or two oil majors.
  • Different share classes of the same company.
  • ETFs and their underlying baskets.
  • Related futures: different delivery locations or closely linked commodities.
  • Currency pairs of linked economies (with caution).

Economic reasoning for why the relationship should hold makes results much more trustworthy.

Frequently asked questions#

What is cointegration?#

A property of two or more non stationary series whose combination is stationary, meaning they share a long run relationship and tend to move back together.

What is the difference between correlation and cointegration?#

Correlation measures how returns move together in the short term; cointegration measures whether prices stay tied together over the long run.

How is cointegration used in trading?#

Mainly in pairs trading and statistical arbitrage, where traders buy and sell the spread between cointegrated assets when it moves away from its average.

Next, learn whether one series helps predict another in Granger Causality.

Check your understanding

3 quick questions on this lesson. Get them all right to finish it.

Turn on JavaScript to take the quiz.

Finished this lesson?Sign in to save your progress across devices.
Next lessonGranger CausalityGranger causality tests whether past values of one series help predict another. Learn how the test works, market lead lag examples and its limits.

Mentioned in