SECTION 05 / 8

Covariance: multiply paired deviations

2 min read
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.

Same-side deviations have positive products; opposite-side deviations have negative products.
Same-side deviations have positive products; opposite-side deviations have negative products.

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.

Cov⁡pop(x,y)=∑i=1N(xi−μx)(yi−μy)N\operatorname{Cov}_{pop}(x,y)=\frac{\sum_{i=1}^{N}(x_i-\mu_x)(y_i-\mu_y)}{N}
sxy=∑i=1n(xi−xˉ)(yi−yˉ)n−1s_{xy}=\frac{\sum_{i=1}^{n}(x_i-\bar{x})(y_i-\bar{y})}{n-1}

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.

AgeHeightx − 3y − 92.6Product
175-2-17.635.2
285-1-7.67.6
39401.40
410118.48.4
5108215.430.8
Total82

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 deviationPrice deviationProduct
16-22-4
25-11-1
34000
431-1-1
522-2-4
Means: 3 and 4Sum = −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.

YOUR STUDY PROGRESS

Finished this section? Save your progress.

Back to top ↑