Covariance – Definition, Formula, and Practical Video Example

4 min read

What does covariance tell us’ In mathematics and Statistics, Covariance gives the directional relationship between the two variables. It means covariance tell us how one variable changes are associated with the second variable. Covariance can be calculated by analyzing the correlation between the two variables by each variable’s standard deviation.


The Covariance Formula

The formula is:
Cov(X,Y) = Σ E((X-μ)E(Y-ν)) / n-1 where:
X is a random variable
E(X) = μ is the expected value (the mean) of the random variable X and
E(Y) = ν is the expected value (the mean) of the random variable Y
n = the number of items in the data set

Video: Calculate the correlation coefficient by using Excel


Calculate covariance for the following data set:
x: 2.1, 2.5, 3.6, 4.0 (mean = 3.1)
y: 8, 10, 12, 14 (mean = 11)

Substitute the values into the formula and solve:
Cov(X,Y) = ΣE((X-μ)(Y-ν)) / n-1
= (2.1-3.1)(8-11)+(2.5-3.1)(10-11)+(3.6-3.1)(12-11)+(4.0-3.1)(14-11) /(4-1)
= (-1)(-3) + (-0.6)(-1)+(.5)(1)+(0.9)(3) / 3
= 3 + 0.6 + .5 + 2.7 / 3
= 6.8/3
= 2.267

The result is positive, meaning that the variables are positively related.

Advantages of the Correlation Coefficient

The Correlation Coefficient has several advantages over covariance for determining strengths of relationships:

  • Covariance can take on practically any number while a correlation is limited: -1 to +1.
  • Because of it’s numerical limitations, correlation is more useful for determining how strong the relationship is between the two variables.
  • Correlation does not have units. Covariance always has units.
  • Correlation isn’t affected by changes in the center (i.e. mean) or scale of the variables.

What is the difference between covariance and correlation?

A correlation has no dimension and it is free to measure between the variables whereas covariance is the measure of correlation. Commonly it is said to be a measure which is used to represent the random variables is known as correlation.

Is covariance always positive?

Positive covariance always positively related whereas the negative covariance inversely related hence it needs not to be always positive. Depends on the variables.

  • What’s inside gun cleaning kit

    Get the best “Cleaning your Gun” Guide Here

    What’s the most important thing you do after brushing up your teeth and exercise? Yes, it’…

Check Also

The Latest Oscars Odds for 2021 Academy Awards

We are still quite a ways away from the 2021 Academy Awards. But the 93rd Oscars ceremony …