Basic Prerequisites: 02 · Cointegration & the Spread and 04 · Trading Rules & Backtest.
1. Intuition & Practical Objective
Three extensions take StatArb beyond the two-asset t-test:
- Johansen’s multivariate test - instead of a pair, allow a basket and ask “how many* independent equilibrium relationships exist?” (the cointegrating rank). This is the correct tool when several assets share the same factors and you do not want to pre-pick a pair.
- Optimal stopping / stochastic control of the OU spread - instead of fixed thresholds, solve for the thresholds that maximise expected return per unit time net of costs.
- Dynamic hedging (Kalman filter) - replace the static OLS with a time-varying estimated recursively, so the hedge adapts when the relationship drifts (the bridge to Signal Processing & Kalman Filtering).
All three keep the OU spread at the centre; they differ in how many assets and how much structure they assume.
2. Mathematical Ground Truth & Derivations
2.1 The Johansen procedure (Tsay §8.6.2–8.6.3; Johansen 1988/1991)
Start from a VAR() in levels and rewrite it in error-correction form for a -dimensional vector :
The rank of is the cointegrating rank : , with () the cointegrating vectors and the adjustment speeds.
Estimation (the reduced-rank regression). Run two auxiliary regressions and collect residuals:
Form the moment matrices , and solve the generalised eigenvalue problem
The cointegrating vectors are the eigenvectors, normalised so .
Tests (H0: rank ). Two standard statistics, with nonstandard (Brownian-motion) critical values:
For with a restricted constant, the 95% critical values are (rank ) and (rank ): reject “no cointegration” if the first exceeds , and fail to reject rank 1 if the second is below .
2.2 Multivariate StatArb (Avellaneda–Lee “generalized pairs trading”)
Trade a stock against a weighted portfolio (basket) rather than a single peer. With factors and residuals , the “generalized” spread is the idiosyncratic residual , and the same OU/z-score machinery applies per stock. Market-neutrality holds at the book level, so the net factor exposure cancels.
2.3 Optimal stopping / thresholds (Elliott, van der Hoek & Malcolm 2005; Bertram 2010)
Model the spread as an OU process and the trade as a first-passage problem: enter at level , exit at level ( for a long-spread trade). The cycle time (entry→exit + exit→next entry) is random; the return per cycle is deterministic, with cost . By renewal theory the expected return and variance per unit time are
and come from the first-passage-time density of the OU process (Itô-transformed to a dimensionless system). Maximising a Sharpe-type objective over yields the optimal thresholds - recovering the fixed rule as a special (suboptimal-in-general) case.
2.4 Dynamic hedge ratio (Kalman filter)
Let follow a random walk with observation . The Kalman filter gives the one-step-ahead estimate ; use it as the hedge ratio so the spread is . This turns the static cointegration regression into an adaptive one - essential when drifts slowly (see the sibling topic for the full state-space derivation).
3. Computational Implementation - the Johansen trace test
Stdlib only. We simulate a genuine cointegrated bivariate system (random walk , and stationary) so the true rank is 1, then run the full Johansen reduced-rank regression with a 2×2 analytic generalised-eigenvalue solve.
The procedure recovers the simulated rank exactly: the first trace statistic () is far above its critical value (reject “no cointegration”), while the second () sits below (a second vector is not supported). The estimated is a measure of how strongly the equilibrium is restored by the error-correction term.
4. Failure Modes & First-Principles Breakdowns
- Johansen critical values depend on the deterministic spec. The five cases (no constant, restricted constant, unrestricted constant, restricted/unrestricted trend; Tsay §8.6.1) have different tables. Resembling the wrong table invalidates the rank conclusion.
- Rank ≠ profitability. A system can have rank 1 with an unfavourably slow adjustment ( small) or a spread whose is tiny relative to costs - econometrically cointegrated, economically untradeable.
- Basket legibility. Trading a stock against a basket multiplies transaction costs and creates netting and borrow complexity; Avellaneda–Lee rely on the net ETF position being small, which need not hold in stress.
- Optimal-stopping thresholds assume stationarity. The Elliott/Bertram solution is only optimal under a fixed OU; the moment the parameters drift or the equilibrium breaks, the “optimal” thresholds are worse than a plain stop.
- Kalman can chase noise. If the state-noise variance is set too high, the hedge ratio over-fits recent co-movement and the spread becomes white noise by construction (a filter artefact, not cointegration).
- The nested risk. These extensions add parameters to a problem whose core risk (structural break, Ch 5) they do not fix. More machinery is not robustness.
5. References
- Tsay, Analysis of Financial Time Series
- Johansen, S., “Statistical Analysis of Cointegration Vectors”, Journal of Economic Dynamics and Control 12(2–3), 1988; and Econometrica 59(6), 1991.
- Avellaneda, M. & Lee, J.-H., Quantitative Finance 10(7), 2010
- Elliott, R. J., van der Hoek, J. & Malcolm, W. P., “Pairs Trading”, Quantitative Finance 5(3), 2005
- Krauss, C., J. Economic Surveys 31(2), 2017
- Harvey, A. C., Forecasting, Structural Time Series Models and the Kalman Filter
6. Connected Graph Bridges
- Back: 05 · Failure Modes · Index Hub
- Sibling: Signal Processing & Kalman Filtering (dynamic hedge ratio) · Fundamental Multi-Factor Models (factor choice for residuals)
- Foundations: Econometrics & Time Series · Linear Algebra & Matrices · Stochastic Calculus & Itô (for the OU first-passage solution)
- Cross-pillar: Transaction Costs & Turnover