top

Covariance Calculator

Input comma-separated values of set x & y and hit the calculate button to find covariance

Formula:
Covx,y = ∑ (xi - x) (yi - y)N-1
ADVERTISEMENT
ADVERTISEMENT

Give Us Feedback

Covariance Calculator

Use the sample covariance calculator for a detailed calculation of the relation between two data sets. This covariance calculator will find the means of both data sets. The table included in the result area contains all the necessary values.

What is covariance?

Covariance in statistics describes the relation between two variables or data sets to see if the change in one affects the other. But the measure of this relation is found by correlation.

Covariance can be positive, negative, or zero.

  • A positive covariance means both are directly related.
  • A negative covariance indicates an indirect relation. 
  • A zero covariance tells both variables are independent of the changes in each other. types

Covariance formula

 To find the covariance, the following formula is used:

 

$$Cov_{x,y}=\frac{\sum \:\:_{i=1}^n\left(\left(x_{i\:}-\:x̄\right)\left(y_i\:-\:ȳ\right)\right)\:\:}{N-1}$$

  • Covx,y is the covariance 
  • xi is the data set of x
  • yi is the data set of y
  • x̄ & ȳ are the mean of the x and y data sets respectively.
  • N is the total numbers in the data set of x & y.

In this equation, the bar (-) above x and y is used to represent the mean. 

How to find covariance?

Calculating covariance is a long process. Several values need to be calculated.

Below are the important steps.

  1. Find the mean of both data sets.
  2. Subtract the individual entries from the respective means of data sets.
  3. Multiply x1 with y1, x2 with y2, and so on after subtraction from the mean.
  4. Add all the values.
  5. Divide by the total number of values minus one (n-1).

Example:

Find the covariance for the given data sets.

X = 12, 13, 14, 15, 15, 18, 11, 12
Y = 20, 11, 12, 15, 11, 13, 12, 17

Solution:

Step 1: Find the mean of both sets.

Mean of X = 12 + 13 + 14 + 15 + 15 + 18 + 11 + 12
                 = 110 / 8
                 = 13.75

Mean of Y = 20 + 11 + 12 + 15 + 11 + 13 + 12 + 17
                  = 111 / 8
                  = 13.875

Step 2: Subtract and multiply as explained.

xixi -  ͞xyiyi -  ͞y(xi -  ͞x) (yi -  ͞y)

12

- 1.75206.13-10.73

13

-0.7511-2.882.16

14

-0.2512-1.88-0.47

15

1.25151.131.41

15

1.2511-2.88-3.60

18

4.2513-0.88-3.74

11

-2.5012-1.885.17

12

-1.5173.13-5.48

Step 3: Add these values.

=  (-10.73) + 2.16+ (-0.47) + 1.41+ (-3.60) + (-3.74) + 5.17 + (-5.48)

= 15.28

Step 4: Use the covariance formula.

Cov( x,y) = ∑ (xi - ͞x ) (yi -͞y ) / n-1  

               = 15.28 / 8 -1 

               = 15.28 / 7

               = -2.18

The number shows a negative covariance. Use our sample covariance calculator to cross-check the above result.

References

  • Covariance. Corporate Finance Institute. (2022, November 4).
X
Allmath loader
AdBlocker Detected!

To calculate result you have to disable your ad blocker first.