Basic Prerequisites: 02 · Cointegration & the Spread.


1. Intuition & Practical Objective

A trading rule is only as good as the pair it is applied to. This page answers the two questions that come before any signal: which two assets? and in what ratio? There are two schools:

  • Distance method (Gatev, Goetzmann & Rouwenhorst, 2006) - a nonparametric screen. Normalise each price to a cumulative-return index, compute the sum of squared deviations between every pair, and trade the closest pairs. It assumes and move together in levels (implicitly on the normalised index). Cheap, robust, but it ignores the statistical structure of the spread.
  • Cointegration method (Vidyamurthy 2004; Avellaneda & Lee 2010) - estimate the equilibrium relationship formally, test the residual for stationarity, and trade the residual of a regression (or of a factor decomposition). More sound econometrically, but more parameters to over-fit.

The hedge ratio is the bridge: the distance method’s “buy one, sell one” is the special case of the regression hedge. Getting right is what makes the book market-neutral - zero exposure to the systematic factors.


2. Mathematical Ground Truth & Derivations

2.1 The distance method (GGR 2006, §2.1)

Let be the normalised cumulative total-return index of stock over the formation window (start ). For every candidate pair ,

Rank all pairs by and trade the top (GGR study the top 5 and top 20, plus pairs 101–120 as a control). Matching in normalised price space is equivalent to assuming a cointegrating vector with two nonzero coordinates and unit scale - “the sum or difference of scaled prices will be reverting to zero” (GGR §1.4). The danger flagged by GGR itself: normalisation is not a test, and spuriously correlated prices will pass.

2.2 The regression hedge ratio

If we accept the cointegrating model , the OLS estimate is

The market-neutral portfolio (long $1 of , short of ) has return equal to the idio residual:

so its exposure to any factor loading cancels when . In log-price space, is the portfolio return of the dollar-neutral book.

2.3 Factor-neutral generalisation (Avellaneda–Lee 2010)

Pairs trading is the two-asset case of a broader statistical arbitrage: decompose each stock’s return against systematic factors,

and trade the idiosyncratic residual . The factors can be sector ETFs (each stock regressed on its peers’ ETF, ) or PCA eigenportfolios (eigenvectors of the return correlation matrix; weights ). A portfolio is market-neutral iff for all ; the first eigenportfolio is the market, higher eigenportfolios are interpretable long–short sector bets (“coherence”).

2.4 Distance vs cointegration - when they agree

On normalised prices, the distance metric is minimised by the pair whose level spread is tightest. If the true relationship is with and small , distance and cointegration agree. When (different volatilities/leverage), distance systematically mis-hedges and the regression hedge is required.


3. Computational Implementation - the distance screen and the hedge ratio

Stdlib only. Build a small synthetic universe: four stocks on factor A (with stationary idio), three on factor B, and one unrelated loner. The distance screen should recover the within-sector pairs, and the top pair’s OLS hedge ratio should be close to on the normalised index.

Every top-5 pair is within sector A - the screen correctly identifies the comoving block and never touches the loner Z. The OLS hedge ratio on the normalised indices is , confirming that for this pair the distance method’s implicit unit hedge is essentially correct.


4. Failure Modes & First-Principles Breakdowns

  1. Selection is a multiple test. Screening stocks gives pairs; the “best” distance is an extreme order statistic and is biased toward spurious fits. GGR mitigate this by fixing the formation/trading split ex ante; modern practice uses the Deflated Sharpe Ratio (Backtesting Hygiene).
  2. Distance ignores . Normalised-price matching forces ; a pair with different volatilities is mis-hedged, leaving residual factor exposure that surfaces as a directional loss in a market move.
  3. Economic link ≠ statistical link. Same-sector stocks can have different regulatory, leverage or commodity exposure. The distance screen finds optical comovement; a structural break in the link (Ch 5) is invisible to it.
  4. Factor model choice drives the residuals (Avellaneda–Lee). PCA vs ETF factors give different residuals and hence different P&L; ETF weights are biased to large caps, PCA factors are not, and the number of significant eigenvalues is itself time-varying.
  5. Look-ahead in normalisation. Using the entire sample to normalise prices leaks future information into the formation window. Normalise strictly on the formation period.

5. References

  • Gatev, Goetzmann & Rouwenhorst, RFS 19(3), 2006
  • Avellaneda, M. & Lee, J.-H., Quantitative Finance 10(7), 2010
  • Vidyamurthy, G., Pairs Trading: Quantitative Methods and Analysis, Wiley, 2004
  • Krauss, C., Journal of Economic Surveys 31(2), 2017
  • Tsay, Analysis of Financial Time Series

6. Connected Graph Bridges