Skip to main content
Interactive 3D/Cointegration
Parameters
β (coeff)1.00
Y₁ − β·Y₂ = stationary spread
T (length)150
Walk noise σ0.50
Spread Statistics
Spread mean: 0.000
Spread std: 0.000
ADF statistic: 0.000
(threshold -2.86)
Spread stationary: No
Interpretation
Both Y₁ and Y₂ are random walks (non-stationary), but their linear combination Y₁ − β·Y₂ is stationary.
This is cointegration. Used in pairs trading: the spread mean-reverts even when individual series drift.
Legend
Y₁
β·Y₂ (dashed)
Spread Y₁−β·Y₂

Cointegration - Interactive Visualization

Two non-stationary series can be cointegrated: their linear combination Y₁ - β·Y₂ is stationary. This means they share a common stochastic trend and cannot drift apart indefinitely. Cointegration underlies pairs trading in finance and error correction models. When the spread deviates, mean-reversion forces push it back.

  • See two random walk series that share a stationary spread
  • Adjust β to find the cointegrating vector that makes spread stationary
  • Click Shock to add divergence and watch mean-reversion occur
  • See ADF test on the spread confirm stationarity
  • Foundation for pairs trading, error correction models, and long-run equilibrium analysis

Part of the EngineersOfAI Interactive 3D - free interactive visualizations covering every major concept in machine learning and AI engineering. Hover any element for a plain-English explanation. No code required.