How to Calculate Covariances
Covariance is a measurement of how related the variances between two variables are. If the two variables both tend to increase together, it is a positive covariance, while if one tends to increase when the other decreases, it is a negative covariance. Zero covariance would indicate that the two variables are independent of each other. A high covariance, either positive or negative, suggests a correlation worth investigating but does not indicate causation.
Instructions


1
Calculate the mean, or average, of the first variable. This is done by adding all the data points and then dividing by the number of data points. For example, take the data sets {1, 3, 3, 5} and {12, 12, 11, 7} for the variables X and Y respectively. The mean for the first variable, X, is: (1 + 3 + 3 + 5) / 4 = 3.

2
Calculate the mean for the second variable the same way you did for the first. Continuing the example, the mean for the second variable, Y, is: (12 + 12 + 11 + 7) / 4 = 10.5.


3
Multiply each data point for the first variable by the corresponding data point for the second variable. Again for the example: {12 x 1, 12 x 3, 11 x 3, 7 x 5} = {12, 36, 33, 35}.

4
Calculate the mean of the data set you created in the step above. This is the mean (XY). Continuing the example: (12 + 36 + 33 +35) / 4 = 29.

5
Multiply the mean of X by the mean of Y. For the example, this is 3 x 10.5 = 31.5.

6
Subtract the difference between the mean of X and Y, as calculated in Step 5, from the mean (XY), as calculated in Step 4. This will give you the covariance. Finishing the example: 29  31.5 = 2.5. This is a negative covariance, indicating that when one variable increased, the other decreased.

1
References
 Photo Credit keypad image by vashistha pathak from Fotolia.com