Lesson 1 of 7
Covariance and correlation
Two numbers describe how two holdings move together. Compute both by hand from five years of returns, and see why only one of them can be compared.
By Javier Sanz
Founder of ValueScreener. Built Ninety Nine, a securities services provider, and sold it to a tier-one global bank; ran operations and internationalization at Alpaca, the brokerage API.
Who writes thisEditorial processLinkedIn (opens in a new tab)X (opens in a new tab)
In one minute
- Covariance is the average product of two holdings' deviations from their own means, and its units are meaningless on their own.
- Correlation is that same number divided by both standard deviations, which puts it on a fixed scale from minus one to one.
- Both are computed from a sample, so both are estimates, and a five-year sample gives a very rough one.
Everything in portfolio arithmetic rests on one quantity: how much two holdings move together. It is computed the same way every time, and doing it once by hand removes most of the mystery from the formulas that follow.
Five years of returns for two holdings
- Holding A
- Holding B
Show the numbers
| Holding A | Holding B | |
|---|---|---|
| Year 1 | 10% | 6% |
| Year 2 | −5% | 0% |
| Year 3 | 15% | 8% |
| Year 4 | 0% | −2% |
| Year 5 | 5% | 8% |
The computation, step by step
Covariance from the series above
-
Find each mean. Holding A averages 5 percent, holding B averages 4 percent.
-
Take deviations from the mean. A gives 5, minus 10, 10, minus 5, 0. B gives 2, minus 4, 4, minus 6, 4.
-
Multiply the pairs: 10, 40, 40, 30 and 0. They sum to 120.
-
Divide by one less than the number of years, so by four. The covariance is 30.
Turning it into a number you can compare
A covariance of 30 means nothing on its own, because it carries the units of both series multiplied together. Dividing by each standard deviation fixes that.
Holding A has a standard deviation of 7.91 percentage points, B has 4.69. So the correlation is 30 divided by 7.91 times 4.69, which is 0.81. The two holdings moved together strongly, but not in lockstep.
What each number is for
Covariance
- Goes directly into the portfolio variance formula, which needs the raw quantity.
- Scale depends on how volatile the two holdings are, so 30 is large for calm assets and small for wild ones.
- Cannot be compared across pairs.
Correlation
- Always between minus one and one, so any two pairs can be compared.
- Says nothing about how large the swings are, only about how aligned they are.
- Two pairs with the same correlation can contribute very different amounts of risk.
Use covariance inside the formulas and correlation when you want to understand what you have.
The part that is usually skipped
Both numbers are estimates from a sample. Five annual observations give an estimate so rough that it should be treated as a direction rather than a measurement, and correlations computed over different windows for the same pair of companies routinely differ by a wide margin.
Worse for an investor, the estimate is least reliable exactly when it matters. Correlations measured in calm years understate what happens in a fall, when holdings that looked independent move together because the same buyer is selling all of them. The next two lessons use these numbers, and the lesson after that shows what happens when the correlation assumption is wrong.
One more property worth knowing
Correlation is not transitive and it is not causal. Two holdings can each be correlated with a third, an oil price or a rate, and barely correlated with each other. Two holdings can be strongly correlated for five years because both happened to rise, without either having anything to do with the other.
That is why the number belongs with a reason. If you can say why two companies would move together, that they sell to the same customers, borrow in the same market, or depend on the same input, then a measured correlation confirms something you already understood. If you cannot, the number is a coincidence waiting to be broken by the next five years.
Check yourself
What is the covariance of the two series above?
- 120
- 30
- 0.81
Show the answer
Answer: B.
The five products of the deviations sum to 120, and dividing by one less than the number of observations, four, gives 30.Why divide covariance by the two standard deviations?
- To make it positive
- To put it on a fixed scale from minus one to one so that different pairs can be compared
- To remove the effect of inflation
Show the answer
Answer: B.
Covariance carries the units of both series, so its size depends on how volatile each one is. Correlation removes that and is comparable.What is the main practical weakness of a correlation estimated from a short sample?
- It is always too high
- It is a rough estimate, and correlations measured in calm periods tend to understate what happens in a fall
- It cannot be computed for shares
Show the answer
Answer: B.
The estimate is noisy in a short sample, and the number that matters most, the one during a decline, is usually higher than the one a calm sample produces.Sources
- Computed for this lesson from the invented five-year series shown in the figure. No external source is used, and none is needed: this is arithmetic.
What this leaves out
- The two return series are invented and chosen so the arithmetic can be checked by hand.
- Five observations is far too few to estimate a correlation in practice, which is part of the lesson rather than a shortcut in it.
- Covariance and correlation describe co-movement of returns. Neither says anything about the chance of permanent loss.
- Nothing here is advice about any security.