Quant Memo
Advanced

The Vector Error Correction Model

The regression that lets two cointegrated series drift apart in the short run but always adds a pull back toward their long-run relationship — the engine behind statistical-arbitrage pairs trading.

Prerequisites: Cointegration, Vector Autoregression (VAR)

Two stock prices can each wander like a random walk on their own — no predictable direction, no mean to revert to — and yet the gap between them behaves completely differently: it wanders in the short run but never strays far before snapping back. That combination (individually unpredictable, jointly anchored) is cointegration, and it's the mathematical basis of pairs trading. But cointegration by itself only tells you the relationship exists; it doesn't tell you how fast the gap closes, or how today's gap should adjust tomorrow's prices. The vector error correction model (VECM) is the regression that answers exactly that: it says each series' next move is partly its own short-run wiggle, and partly a correction proportional to how far the pair currently sits from its long-run equilibrium.

An analogy: two dogs on a leash

Picture two dogs on a leash of fixed length, both wandering around a park. Each dog's individual path, watched alone, looks aimless — no destination, no pattern. But the leash means neither dog can wander arbitrarily far from the other: the moment the leash goes taut, there's a pull back. Watch closely and you'll see it's not perfectly symmetric — maybe the smaller dog gets yanked back harder and faster than the bigger one drags forward. That asymmetric pull, proportional to how taut the leash currently is, is exactly the "error correction" term. The VECM measures how taut the leash is right now (the equilibrium error) and how hard each dog gets pulled back per unit of tautness (the adjustment speed).

gap widens gap widens again A B
Series A and B each drift without a fixed level, but the vertical gap between them keeps snapping back to a stable range. The error-correction term is what makes the next move nudge in the direction that shrinks the gap whenever it opens up.

The model, one symbol at a time

Let yty_t and xtx_t be two cointegrated price series (or a vector of several). First define the equilibrium error, the current gap from the long-run relationship:

zt1=yt1βxt1.z_{t-1} = y_{t-1} - \beta x_{t-1} .

In words: zt1z_{t-1} ("z sub t-minus-1") is how far apart the pair sat last period, after adjusting for the hedge ratio β\beta ("beta") that defines their long-run one-to-one relationship — this is the spread you'd trade. The VECM then models each series' change as:

Δyt=αyzt1+jϕjΔytj+jψjΔxtj+εt.\Delta y_t = \alpha_y\, z_{t-1} + \sum_j \phi_j \,\Delta y_{t-j} + \sum_j \psi_j\, \Delta x_{t-j} + \varepsilon_t .

In words: the change in yy this period equals an adjustment speed αy\alpha_y ("alpha sub y") times last period's gap, plus the usual short-run dependence on recent changes in yy and xx, plus noise. A parallel equation holds for Δxt\Delta x_t with its own adjustment speed αx\alpha_x. The critical quantity is αy\alpha_y: if αy\alpha_y is negative and zt1z_{t-1} was positive (meaning yy was too high relative to xx), then αyzt1\alpha_y z_{t-1} pushes Δyt\Delta y_t downward — yy falls back toward equilibrium. That's the "error correction": a term whose entire job is to shrink last period's disequilibrium.

The VECM splits every move into two parts: ordinary short-run momentum, plus a pull back toward the long-run relationship, sized by how far out of line the pair currently is. The speed of that pull, α\alpha, is the number that tells you how fast a pairs trade should expect to converge.

Worked example 1: computing the correction term

Stock y=y = $102, stock x=x = $100, hedge ratio β=1.0\beta = 1.0 from a prior cointegrating regression. The equilibrium error is zt1=1021.0(100)=2.0z_{t-1} = 102 - 1.0(100) = 2.0yy is $2 rich relative to xx. Suppose the fitted VECM gives αy=0.30\alpha_y = -0.30 and αx=0.10\alpha_x = 0.10 (with short-run terms set to zero for simplicity). Then:

Δyt=0.30×2.0=0.60,Δxt=0.10×2.0=0.20.\Delta y_t = -0.30 \times 2.0 = -0.60, \qquad \Delta x_t = 0.10 \times 2.0 = 0.20 .

So the model predicts yy falls by $0.60 and xx rises by $0.20 next period — the gap shrinks from $2.00 toward $2.00-0.60-0.20 = $1.20, about 60% closed in one step (0.80/2.000.80/2.00, since the two moves jointly close 0.30+0.10=0.400.30+0.10=0.40 of the $1 hedge-adjusted unit... more directly: predicted new gap =1.20= 1.20, a reduction from 2.00, i.e. 0.80/2.00=40%0.80/2.00 = 40\% closed this period). This is a directly tradable prediction: go short yy, long β×x\beta \times x, and the VECM says the position should profit as the gap mean-reverts, at a rate set by αyαx=0.40\alpha_y - \alpha_x = -0.40 per unit of gap per period.

Worked example 2: half-life from the adjustment speed

If short-run terms are negligible, the gap itself roughly follows zt(1+αyαx)zt1z_t \approx (1 + \alpha_y - \alpha_x)\, z_{t-1}, an AR(1)-like decay with persistence λ=1+αyαx=10.300.10=0.60\lambda = 1 + \alpha_y - \alpha_x = 1 - 0.30 - 0.10 = 0.60. The half-life of the mean reversion is

half-life=ln(0.5)ln(λ)=ln(0.5)ln(0.60)=0.6930.511=1.36 periods.\text{half-life} = \frac{\ln(0.5)}{\ln(\lambda)} = \frac{\ln(0.5)}{\ln(0.60)} = \frac{-0.693}{-0.511} = 1.36 \text{ periods} .

In words: starting from a $2.00 gap, you'd expect it to shrink to $1.00 in about 1.36 periods, matching the arithmetic above (gap fell from 2.00 to 1.20, about 60% of the way to zero, faster than one full half-life — consistent, since 1.36 periods should get you to exactly half). This half-life is the single most useful number for sizing a pairs trade's holding period: if daily data gives a half-life of 1.4 days, you're running a fast mean-reversion strategy; a half-life of 40 days means much slower, longer-held convergence bets with correspondingly different risk.

Convergence explorer
true meansamples →
after n = 200estimate -0.025error 0.025std error 0.071

Watch how the running quantity in the explorer settles toward a stable value as more steps accumulate — the equilibrium error in a VECM behaves the same way, oscillating but pulled back, rather than drifting off freely like the individual series do.

What this means in practice

  • This is pairs trading's engine. The hedge ratio β\beta sets the position sizes; the equilibrium error ztz_t is the entry/exit signal; the adjustment speed α\alpha tells you the expected holding period and, combined with the spread's volatility, the expected profit per trade.
  • You need cointegration first. A VECM only makes sense if yy and xx are actually cointegrated — running one on two unrelated random walks manufactures the appearance of mean reversion out of noise, a specific case of spurious regression.
  • Adjustment speed can be asymmetric or one-sided. Sometimes only one series does the correcting (αx0\alpha_x \approx 0) — the "weakly exogenous" series leads, the other follows, which matters for deciding which leg to trade more aggressively.
  • Compare to a simple OLS spread model. A VECM is strictly richer than just trading the residual from a static cointegrating regression, because it also models the short-run dynamics (ϕj,ψj\phi_j, \psi_j) that a plain spread z-score ignores.

The classic confusion: fitting a VECM (or trading a "cointegrated" spread) on a pair that was only cointegrated in-sample by chance, or whose relationship has since broken. Cointegration is a structural, economically-grounded relationship (two share classes of the same firm, a commodity and its close substitute) — it is not something you should conclude purely from a passing statistical test on a short backtest window. A VECM fit on a spuriously cointegrated pair will show a plausible-looking negative α\alpha and a clean half-life right up until the relationship stops holding, at which point the "mean-reverting" spread simply walks away and never comes back.

Related concepts

Practice in interviews

Further reading

  • Engle & Granger (1987), Econometrica
  • Hamilton, Time Series Analysis, ch. 19-20
ShareTwitterLinkedIn