Covariance Calculator
Calculate the covariance between two variables to understand their relationship.
Enter Your Data
Table of Contents
Covariance Formula
Covariance is a measure of the joint variability of two random variables. It indicates the direction of the linear relationship between variables.
Where:
- cov(X,Y) is the covariance between X and Y
- Σ is the sum of
- x and y are individual values
- μx and μy are the means of X and Y
- n is the number of values
How to Calculate Covariance
To calculate covariance, follow these steps:
-
1Calculate the mean of both X and Y variables
-
2Subtract the means from their respective values
-
3Multiply the differences for each pair of values
-
4Sum all the products and divide by (n-1)
Interpreting Covariance
Understanding what the covariance tells you about the relationship between variables:
-
1Positive Covariance:
Indicates that as one variable increases, the other tends to increase as well.
-
2Negative Covariance:
Indicates that as one variable increases, the other tends to decrease.
-
3Zero Covariance:
Indicates that there is no linear relationship between the variables.
Practical Examples
Example 1 Height and Weight
X (Height in cm): 160, 165, 170, 175, 180
Y (Weight in kg): 55, 60, 65, 70, 75
Covariance = 62.5
Positive covariance shows that height and weight tend to increase together.
Example 2 Temperature and Ice Cream Sales
X (Temperature in °C): 20, 25, 30, 35, 40
Y (Sales in units): 100, 120, 140, 160, 180
Covariance = 250
Positive covariance indicates that higher temperatures lead to more ice cream sales.
Example 3 Study Hours and Sleep Hours
X (Study hours): 2, 4, 6, 8, 10
Y (Sleep hours): 8, 7, 6, 5, 4
Covariance = -4
Negative covariance shows that more study hours correlate with fewer sleep hours.