Cointegration is a statistical relationship between two or more non-stationary time series where a specific linear combination of them produces a stationary process. Unlike correlation, which measures short-term directional alignment, cointegration identifies a long-run equilibrium relationship. If a portfolio of assets is cointegrated, the spread between them is mean-reverting, meaning deviations from the equilibrium are temporary and will eventually correct, creating a predictable trading signal.
Glossary
Cointegration

What is Cointegration?
Cointegration is a statistical property of a time series portfolio where a linear combination of non-stationary asset prices is stationary, forming the basis for mean-reverting pairs trading strategies.
The classic test for cointegration is the Engle-Granger two-step method, which first regresses one asset price on another to estimate the cointegrating vector, then tests the residuals for stationarity using an augmented Dickey-Fuller test. In pairs trading, a trader goes long the undervalued asset and short the overvalued one when the spread widens beyond a threshold, profiting as it reverts. The half-life of mean reversion quantifies how quickly this convergence occurs, directly informing optimal trade duration and position sizing.
Key Characteristics of Cointegration
Cointegration is a statistical property of a time series portfolio where a linear combination of non-stationary asset prices is stationary, forming the basis for mean-reverting pairs trading strategies.
Stationary Linear Combination
The core property of cointegration is that while individual asset price series are non-stationary (containing unit roots), a specific linear combination of them is stationary. This means the spread between the assets has a constant mean and variance over time, reverting to equilibrium rather than wandering randomly. Formally, if two I(1) series X and Y are cointegrated, there exists a coefficient β such that X - βY is I(0). This stationary spread is the tradable signal in pairs trading.
Long-Run Equilibrium Relationship
Cointegration implies a long-run equilibrium relationship between the assets. Economic forces or shared risk factors bind the series together, preventing them from diverging indefinitely. When the spread deviates from this equilibrium, it is expected to revert, creating a trading opportunity. This contrasts with correlation, which measures short-term directional co-movement but says nothing about long-run convergence. Two assets can be highly correlated yet not cointegrated if their prices drift apart over time.
Engle-Granger Two-Step Method
The Engle-Granger test is a classic method for detecting cointegration:
- Step 1: Regress one asset price on the other using OLS to estimate the cointegrating vector: Y = α + βX + ε
- Step 2: Test the residuals ε for a unit root using the Augmented Dickey-Fuller (ADF) test. If the residuals are stationary, the series are cointegrated. This method is simple but assumes one asset is the dependent variable, which can produce different results depending on the ordering.
Johansen Multivariate Test
The Johansen test extends cointegration analysis to multiple time series simultaneously, overcoming the limitations of the Engle-Granger approach. It uses a Vector Error Correction Model (VECM) framework to identify the number of cointegrating relationships (the cointegrating rank) in a system of n variables. The test provides two statistics:
- Trace statistic: Tests the null of r or fewer cointegrating vectors
- Maximum eigenvalue statistic: Tests the null of exactly r cointegrating vectors against r+1 This method is symmetric and does not require choosing a dependent variable.
Error Correction Mechanism (ECM)
Cointegrated systems exhibit an error correction mechanism: short-term deviations from the long-run equilibrium are corrected over time. The ECM model captures this dynamic by including the lagged residual (the error correction term) as a regressor:
- ΔY_t = α(Y_{t-1} - βX_{t-1}) + γΔX_t + ε_t The coefficient α measures the speed of adjustment back to equilibrium. A negative and significant α confirms that the dependent variable adjusts to correct disequilibrium. This framework separates long-run equilibrium dynamics from short-run fluctuations.
Half-Life of Mean Reversion
The half-life of mean reversion quantifies how quickly a cointegrated spread reverts to its mean after a deviation. It is calculated from the error correction coefficient α as:
- Half-Life = -ln(2) / ln(1 + α) A shorter half-life indicates faster reversion and is generally more desirable for trading, as it implies more frequent round-trip trades. However, very short half-lives may indicate noise rather than a genuine tradable signal. Typical half-lives for viable pairs range from a few days to several weeks.
Frequently Asked Questions
Clear, technical answers to the most common questions about cointegration, its statistical foundations, and its application in mean-reverting trading strategies.
Cointegration is a statistical property of a multivariate time series where a linear combination of two or more non-stationary price series is itself stationary. In practical terms, this means that while individual asset prices may wander randomly without a fixed mean, a specific weighted combination of them—called the cointegrating vector—reverts to a long-run equilibrium. The mechanism relies on an error correction model (ECM): when the spread between the assets deviates from its historical mean, economic forces or arbitrage activity push it back. This property is the mathematical foundation for pairs trading and statistical arbitrage, as it identifies assets that share a common stochastic trend, allowing traders to profit from temporary dislocations while maintaining a market-neutral posture.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Mastering cointegration requires understanding the statistical and trading concepts that surround it. These cards explain the essential building blocks for developing and evaluating mean-reverting strategies.
Half-Life of Mean Reversion
The estimated time it takes for a cointegrated spread to revert halfway back to its long-term equilibrium mean after a deviation. This metric directly dictates the optimal trading horizon.
- Calculation: Derived from an AR(1) model fitted to the spread: Half-Life = -ln(2) / ln(θ), where θ is the autoregressive coefficient.
- Trading Implication: A half-life of 3 days suggests a short-term mean-reversion strategy; a half-life of 30 days suggests a slower, longer-horizon approach.
- Practical Use: If the half-life is too long (e.g., >100 days), the strategy ties up capital inefficiently. If too short (e.g., <1 hour), transaction costs may erode profits.
Stationarity & Unit Root Tests
A time series is stationary if its statistical properties—mean, variance, and autocorrelation—are constant over time. Cointegration requires the spread to be stationary, even if the individual assets are not.
- Augmented Dickey-Fuller (ADF) Test: The primary statistical test for stationarity. A p-value < 0.05 rejects the null hypothesis of a unit root (non-stationarity).
- Why It Matters: Trading a non-stationary spread is dangerous; it has no equilibrium to revert to and can wander arbitrarily far, leading to unbounded losses.
- Common Pitfall: Structural breaks in the relationship can cause a previously stationary spread to become non-stationary, invalidating the strategy.
Johansen Test
A multivariate extension of cointegration testing that can identify multiple cointegrating relationships within a basket of more than two assets, unlike the two-step Engle-Granger method.
- Trace Statistic: Tests the null hypothesis of r or fewer cointegrating vectors against the alternative of more than r.
- Maximum Eigenvalue Statistic: Tests the null of r cointegrating vectors against the specific alternative of r+1.
- Portfolio Application: Essential for constructing statistical arbitrage baskets of 3+ stocks, where multiple equilibrium relationships may exist simultaneously.
Engle-Granger Two-Step Method
The foundational methodology for testing cointegration between two time series. Simple to implement but limited to identifying a single cointegrating relationship.
- Step 1: Regress one asset's price on the other using OLS to estimate the long-run equilibrium relationship: Y_t = α + βX_t + ε_t.
- Step 2: Test the residuals (ε_t) for stationarity using the ADF test. If stationary, the series are cointegrated.
- Limitation: The test result can depend on which asset is chosen as the dependent variable, and it cannot handle more than one cointegrating vector.
Pairs Trading
The most direct application of cointegration: a market-neutral strategy that simultaneously buys the underperforming asset and sells short the overperforming asset in a cointegrated pair.
- Entry Signal: When the spread widens beyond a threshold (e.g., 2 standard deviations from the mean), short the winner and go long the loser.
- Exit Signal: When the spread reverts back to its mean or crosses to the opposite threshold.
- Risk: The relationship can permanently break down due to a merger, regulatory change, or fundamental business shift, causing the spread to diverge without reverting.
Z-Score & Bollinger Bands
The Z-Score normalizes the cointegration spread to a standard scale, measuring how many standard deviations the current spread is from its historical mean. This is the core signal generator.
- Formula: Z = (Spread_t - μ_spread) / σ_spread
- Bollinger Bands: A visualization tool that plots a moving average of the spread with upper and lower bands at ±k standard deviations. A breach of the bands triggers a trade.
- Calibration: A Z-score threshold of ±2.0 is common, but optimal thresholds should be determined via walk-forward optimization to avoid overfitting.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us