Cointegration: Hedge Ratio, Spread Z-Score and Half-Life
Finds: whether a pair behaves like a stable spread and how fast it reverts.
When to use it: Use it to test whether two prices share a long-run link. Each price may wander, but if a mix of them is stable the pair is cointegrated and the gap tends to close. The half-life says how fast. A full test also needs a unit-root test on the spread (Engle-Granger), which this calculator does not run, so treat the result as a screen and not proof.
The formula
In words: Hedge ratio beta = Covariance(Y, X) / Variance(X); Spread = Y − beta x X − alpha; Fit spread today = phi x spread yesterday; Half-life = -ln 2 / ln(phi)
What each symbol means
| Y, X | Two price series that may move together | money |
| beta | Hedge ratio from regressing Y on X | number |
| alpha | Intercept of that regression | money |
| phi | Autoregressive coefficient of the spread. Between 0 and 1 means it reverts | number |
| t_1/2 | Half-life: periods for a gap to close by half | periods |
Worked example
Two price series of 30 observations each are given in the calculator. Regress Y on X, build the spread, find its latest z-score and the half-life.
| Hedge ratio | 1.3940 | |
| Intercept | 14.7347 | |
| Spread series | 0.56, −0.32, −0.37, −0.77, −0.93, 0, −0.38, −0.05, 0.59, 0.12, 0.17, 0.35, 0.43, −0.41, −0.14, 0.90, −0.31, 0.33, 0.17, −0.39, 0.70, 0.84, −0.38, −0.32, −0, −0.26, −0.17, −0.41, −0.12, 0.55 | |
| Latest z-score | 1.181 | |
| phi | 0.1321 | |
| Half-life | −ln(2) ÷ ln(0.132143) | 0.34 |
The hedge ratio is 1.3940 and the intercept is 14.7347. The latest spread sits 1.181 standard deviations from its mean. The spread's persistence is 0.1321, so a gap closes by half in 0.34 periods.