Covariance and Correlation
Covariance and correlation measure how two assets move together. Learn the formulas, how to read them, why correlations change in crises and their portfolio role.
Covariance and correlation measure how two variables move together. In markets, they show whether two assets tend to rise and fall at the same time, move in opposite directions or have no consistent link. Correlation is central to diversification, hedging, pairs trading and portfolio construction. Understanding it, and its limits, helps traders avoid concentrated risk and build portfolios that hold up in different conditions.
Covariance#
Cov(X, Y) = Σ (x - x̄)(y - ȳ) / (n - 1)
Positive covariance means the variables tend to move in the same direction; negative means opposite directions. Covariance depends on the units and scale of the data, so its size is hard to interpret.
Correlation#
Correlation standardises covariance so it always lies between minus 1 and +1:
ρ = Cov(X, Y) / (σ_X × σ_Y)
| Correlation | Meaning |
|---|---|
| +1 | Perfect positive relationship |
| +0.7 | Strong positive |
| 0 | No linear relationship |
| minus 0.7 | Strong negative |
| minus 1 | Perfect negative relationship |
This is Pearson correlation, which measures linear relationships. Spearman rank correlation measures whether the variables move in the same order, and is more robust to outliers. See Outliers and Robust Statistics.
Worked example#
Correlation and diversification#
Combining assets with low correlation reduces portfolio volatility:
σ_p² = w1² σ1² + w2² σ2² + 2 w1 w2 ρ σ1 σ2
Correlations change#
Correlations are not fixed. In market crises, correlations between risky assets often rise sharply, so diversification fails exactly when it is needed. In 2022, stocks and bonds fell together, breaking the negative correlation many portfolios relied on during the previous two decades. Traders monitor rolling correlations over several windows. See Correlation Management and Structural Breaks and Regime Changes.
Correlation is not causation#
Two assets can be correlated because one drives the other, because both respond to a common factor or purely by chance. Spurious correlations are common in data mining. Correlation also misses nonlinear relationships: two variables can be strongly related but show near zero correlation. See Granger Causality.
Correlation vs cointegration#
Correlation measures how returns move together day to day. Cointegration measures whether prices stay together over the long run. Two stocks can be highly correlated yet drift apart, or have modest correlation yet stay tied together. Pairs traders care about cointegration. See Cointegration and Pairs Trading.
Beta and correlation#
A stock's beta to the market combines correlation with relative volatility:
β = ρ × (σ_stock / σ_market)
See Alpha and Beta.
Estimating correlation in practice#
Use returns, not prices, because trending prices create misleading correlations. Choose a window long enough to be stable, such as 60 to 250 trading days, and compare it with shorter windows to see changes. For assets that trade at different times, such as US and Asian stocks, daily returns can understate correlation; weekly returns help. See Rolling and Expanding Windows.
Frequently asked questions#
What is the difference between covariance and correlation?#
Covariance measures how two variables move together in their original units; correlation standardises it to a scale from minus 1 to +1.
Why does correlation matter in trading?#
It determines how much diversification you get, how well hedges work and whether positions concentrate the same risk.
Do correlations stay the same?#
No. They change over time and often rise during market stress, reducing diversification when it is most needed.
Next, learn how reliable estimates from samples are in Sampling and Standard Error.
3 quick questions on this lesson. Get them all right to finish it.
Turn on JavaScript to take the quiz.
Mentioned in
- Random VariablesMath and Statistics
- Variance and Standard DeviationMath and Statistics
- Percentiles, Quantiles and Z-ScoresMath and Statistics
- Time Series BasicsMath and Statistics
- CointegrationMath and Statistics
- Rolling and Expanding WindowsMath and Statistics