Covariance: A Numerical Example
Data Science and A.I. Lecture Series
Problem Statement and Table of Deviations
Example: Calculate the covariance between the age of husband and wife of the following seven couples.
Data:
- Age of Husband \( X \): 35, 34, 40, 43, 56, 20, 38
- Age of Wife \( Y \): 32, 30, 31, 32, 53, 20, 33
Deviations are: \( u_i = x_i – 40 \) and \( v_i = y_i – 32 \).
Table of Deviations and Products:
\( x_i \) | \( u_i = x_i – 40 \) | \( y_i \) | \( v_i = y_i – 32 \) | \( u_i v_i \) |
---|---|---|---|---|
35 | -5 | 32 | 0 | 0 |
34 | -6 | 30 | -2 | 12 |
40 | 0 | 31 | -1 | 0 |
43 | 3 | 32 | 0 | 0 |
56 | 16 | 53 | 21 | 336 |
20 | -20 | 20 | -12 | 240 |
38 | -2 | 33 | 1 | -2 |
Covariance Calculation
The formula for covariance is:
\[
\text{Cov}(X, Y) = \frac{1}{n} \sum u_i v_i – \left( \frac{1}{n} \sum u_i \right) \left( \frac{1}{n} \sum v_i \right)
\]
Substituting the values:
- \( n = 7, \, \sum u_i v_i = 586, \, \sum u_i = -14, \, \sum v_i = 7 \)
- Step 1: \( \frac{1}{n} \sum u_i v_i = \frac{586}{7} \)
- Step 2: \( \frac{1}{n} \sum u_i = \frac{-14}{7} = -2 \quad \text{and} \quad \frac{1}{n} \sum v_i = \frac{7}{7} = 1 \)
- Step 3: Combine:
\[
\text{Cov}(X, Y) = \frac{586}{7} – (-2)(1)
\] - Step 4: Simplify:
\[
\text{Cov}(X, Y) = 85.71
\]
Result Interpretation
Final Answer: The covariance is \( 85.71 \).
Interpretation:
- The positive covariance (\( 85.71 \)) indicates a direct relationship.
- As the age of the husband increases, the age of the wife also tends to increase.
Covariance measures the linear association between two variables. A positive value means both variables move in the same direction.
PDF Presentation
covexample2Video
Reach PostNetwork Academy
Website: PostNetwork Academy
YouTube Channel: PostNetwork Academy YouTube
Facebook Page: PostNetwork Academy Facebook
LinkedIn Page: PostNetwork Academy LinkedIn