You entered x = { 1 , 2 , 3 , 4 } y = { 2 , 4 , 6 , 8 } x = \left\{ 1,\ 2,\ 3,\ 4 \right\} \quad y = \left\{ 2,\ 4,\ 6,\ 8 \right\} x = { 1 , 2 , 3 , 4 } y = { 2 , 4 , 6 , 8 }
Sample covariance 3.333333 , population covariance 2.5 \displaystyle \text{Sample covariance } 3.333333,\ \text{population covariance } 2.5 Sample covariance 3.333333 , population covariance 2.5 Copy result Copy link
Fraction
10 3 \displaystyle \frac{10}{3} 3 10 Show the work 1 Means of x and y
Covariance measures how x and y move together around their means, so find the means first. There are n = 4 n = 4 n = 4 pairs.
x ˉ = 2.5 y ˉ = 5 \begin{gathered} \bar{x} = 2.5 \\ \bar{y} = 5 \end{gathered} x ˉ = 2.5 y ˉ = 5 2 Sum of products of deviations
Each pair contributes the product of its two deviations: positive when both are above or both below their means, negative when one is above and the other below.
S x y = ∑ ( x − x ˉ ) ( y − y ˉ ) = ( 1 − 2.5 ) ( 2 − 5 ) + ( 2 − 2.5 ) ( 4 − 5 ) + ( 3 − 2.5 ) ( 6 − 5 ) + ( 4 − 2.5 ) ( 8 − 5 ) = 10 \begin{aligned} S_{xy} &= \sum \left(x - \bar{x}\right)\left(y - \bar{y}\right) \\ &= \left(1 - 2.5\right)\left(2 - 5\right) + \left(2 - 2.5\right)\left(4 - 5\right) + \left(3 - 2.5\right)\left(6 - 5\right) + \left(4 - 2.5\right)\left(8 - 5\right) \\ &= 10 \end{aligned} S x y = ∑ ( x − x ˉ ) ( y − y ˉ ) = ( 1 − 2.5 ) ( 2 − 5 ) + ( 2 − 2.5 ) ( 4 − 5 ) + ( 3 − 2.5 ) ( 6 − 5 ) + ( 4 − 2.5 ) ( 8 − 5 ) = 10 3 Covariance
Divide by n − 1 n - 1 n − 1 when the pairs are a sample, and by n n n when they are the whole population.
Using s x y = S x y n − 1 , σ x y = S x y n s_{xy} = \frac{S_{xy}}{n - 1},\quad \sigma_{xy} = \frac{S_{xy}}{n} s x y = n − 1 S x y , σ x y = n S x y
s x y = 10 3 ≈ 3.333333 σ x y = 10 4 = 2.5 \begin{gathered} s_{xy} = \frac{10}{3} \approx 3.333333 \\ \sigma_{xy} = \frac{10}{4} = 2.5 \end{gathered} s x y = 3 10 ≈ 3.333333 σ x y = 4 10 = 2.5 4 Result
So the sample covariance is 10 3 ≈ 3.333333 \frac{10}{3} \approx 3.333333 3 10 ≈ 3.333333 and the population covariance is 2.5 2.5 2.5 .