Covariance: multiply paired deviations
On this page 4 headings
Covariance measures whether two numerical variables tend to move above and below their own means together. Its sign is easier to interpret than its size.
Why multiply deviations?
When x and y are both above their means, both deviations are positive and their product is positive. When both are below, negative times negative is positive. When one is above and the other below, the product is negative. Summing these products reveals the overall tendency.
Use population means and N for the population version; use sample means and n−1 for the sample version. Keep the paired observations together.
Worked example: age and height
The age mean is 3 years; the height mean is 92.6 cm. Subtract these means, then multiply the deviations within each row.
| Age | Height | x − 3 | y − 92.6 | Product |
|---|---|---|---|---|
| 1 | 75 | -2 | -17.6 | 35.2 |
| 2 | 85 | -1 | -7.6 | 7.6 |
| 3 | 94 | 0 | 1.4 | 0 |
| 4 | 101 | 1 | 8.4 | 8.4 |
| 5 | 108 | 2 | 15.4 | 30.8 |
| Total | 82 |
Population covariance = 82/5 = 16.4 year·cm. Sample covariance = 82/4 = 20.5 year·cm. Both signs are positive: greater age tends to occur with greater height in this small dataset.
Worked example: car age and price
| Age (years) | Price (lakh rupees) | Age deviation | Price deviation | Product |
|---|---|---|---|---|
| 1 | 6 | -2 | 2 | -4 |
| 2 | 5 | -1 | 1 | -1 |
| 3 | 4 | 0 | 0 | 0 |
| 4 | 3 | 1 | -1 | -1 |
| 5 | 2 | 2 | -2 | -4 |
| Means: 3 and 4 | Sum = −10 |
Population covariance = −10/5 = −2 year·lakh rupees. Sample covariance = −10/4 = −2.5. The negative sign matches the falling relationship.
Source correction: an intermediate slide gives the last price deviation as −1. It is −2 because 2−4 = −2. The final worked table and total −10 use the correct value.
Units make the magnitude hard to compare
Covariance has units of x multiplied by units of y. Converting height from cm to m divides its covariance with age by 100, even though the relationship has not changed. Therefore “a covariance of 20 is stronger than 2” is not a safe comparison across different scales. Adding constants does not change covariance; multiplying x by a and y by b multiplies covariance by ab.
Try it yourself
For pairs (1,2),(2,4),(3,6), find sample covariance.
Show explained answer
Means are 2 and 4. Products of deviations are 2,0,2. Sum = 4; divide by n−1 = 2 to get 2.
Try it yourself
If one deviation is −3 and the other is +5, what is their product?
Show explained answer
−15. Opposite signs contribute negatively to covariance.
Try it yourself
If price changes from lakh rupees to rupees, does covariance keep the same numerical value?
Show explained answer
No. Multiplying price by 100,000 multiplies its covariance with age by 100,000.
Source: Lecture 4.6. Extra examples and diagrams are teaching material prepared for these notes.
