Top

Covariance Calculator
Top
Covariance calculator is used to measure the two variables (i.e. X and Y) by changing together and calculate the sample mean, co variance between the two random variables.

The number of values (N) should be same for two variables (X and Y).

## Step by Step Calculation

Step 1 :

Below you could see the steps for solving problems

Step a: Find the mean for X and Y

Mean = $\frac{Sum\ of\ values\ entered}{N}$

Step b: Subtract all the values of X and Y with their respective mean

Step c: Multiply respected values of step b.

Step d: Add all the values of step c.

Step e: Apply covariance formula

Cov(X, Y) = $\frac{\sum (x_{i} - \bar{x}) (y_{i} - \bar{y})}{N}$

Where xi = Entered values of X

$\bar{X}$ = Mean Value for X

Xi = Values of X

Yi = Values of Y

$\bar{Y}$ = Mean value for Y

N = number of entered values

Step 2 :

Put the values in the formula and solve it further.

## Example Problems

1. ### Find the covariance for the following data sets,X = 10, 20, 30, 60Y = 40, 50, 60, 80

Step 1 :

Give: X = 10, 20, 30, 60

Y = 40, 50, 60, 80

N = 4

Mean X      = $\frac{10+20+30+60}{4}$

= $\frac{120}{4}$

$\bar{Y}$ = 30

Mean Y = $\frac{40+50+60+80}{4}$

= $\frac{230}{4}$

$\bar{X}$ = 57.5

Xi - $\bar{X}$ = 10 - 30 = -20

Xi - $\bar{X}$ = 20 - 30 = -10

Xi - $\bar{X}$ = 30 - 30 = 0

Xi - $\bar{X}$ = 60 - 30 = 30

Yi - $\bar{Y}$ = 40 - 57.5 = -17.5

Yi - $\bar{Y}$ = 50 - 57.5 = 7.5

Yi - $\bar{Y}$ = 60 - 57.5 = 2.5

Yi - $\bar{Y}$ = 80 - 57.5 = 22.5

Step 2 :

Apply covariance formula

Cov(X, Y) = $\frac{\sum (x_{i} - \bar{x}) (y_{i} - \bar{y})}{N}$

= $\frac{(-20 * -17.5)+(-10 * -7.5)+(0 * 2.5)+(30 * 22.5)}{4}$

= $\frac{350+75+0+675}{4}$

= $\frac{1100}{4}$

= 275

Cov(X, Y) = 275

Mean X = 30

Mean Y = 57.5

Number of values N = 4

Cov(X, Y) = 275

2. ### Find the covariance for the following data sets, X = 2, 4, 6, 8, 9 Y = 1, 3, 5, 7, 8

Step 1 :

Give: X = 2, 4, 6, 8, 9

Y = 1, 3, 5, 7, 8

N = 5

Mean X    = $\frac{2+4+6+8+9}{5}$

= $\frac{29}{5}$

$\bar{Y}$ = 5.8

Mean Y = $\frac{1+3+5+7+8}{5}$

= $\frac{23}{5}$

$\bar{X}$ = 4.8

Xi - $\bar{X}$ = 2 - 5.8 = -3.8

Xi - $\bar{X}$ = 4 - 5.8 = -1.8

Xi - $\bar{X}$ = 6 - 5.8 = 0.2

Xi - $\bar{X}$ = 8 - 5.8 = 2.2

Xi - $\bar{X}$ = 9 - 5.8 = 3.2

Yi - $\bar{Y}$ = 1 - 4.8 = -3.8

Yi - $\bar{Y}$ = 3 - 4.8 = - 1.8

Yi - $\bar{Y}$ = 5 - 4.8 = 0.2

Yi - $\bar{Y}$ = 7 - 4.8 = 2.2

Yi - $\bar{Y}$ = 8 - 4.8 = 3.2

Step 2 :

Apply covariance formula

Cov(X, Y) = $\frac{\sum (x_{i} - \bar{x}) (y_{i} - \bar{y})}{N}$

$\frac{(-3.8 * -3.8)+(-1.8 * -1.8)+(0.2 * 0.2)+(2.2 * 2.2)+(3.2 * 3.2)}{5}$

= $\frac{14.44+3.24+0.04+4.84+10.24}{5}$

= $\frac{32.8}{5}$

= 6.56

Cov(X, Y) = 6.56

Mean X = 5.8

Mean Y = 4.8

Number of values N = 5

Cov(X, Y) = 6.56

*AP and SAT are registered trademarks of the College Board.