Covariance is the value that reflects how much two random variables vary jointly with respect to their means.

It allows us to know how a variable behaves based on what another variable does. That is, when X goes up, how does Y behave? Thus, covariance can take the following values:

Covariance (X, Y) is less than zero when “X” goes up and “Y” goes down. There is a negative relationship.

Covariance (X, Y) is greater than zero when “X” rises and “Y” rises. There is a positive relationship.

Covariance (X, Y) is equal to zero when there is no existing relationship between the variables “X” and “Y”.

Covariance calculation

The covariance formula is expressed as follows:

Where the y with the accent is the mean of the variable Y, and the x with the accent is the mean of the variable X. “i” is the position of the observation and “n” the total number of observations.

Properties of covariance

When working with it, the properties that it has and which are deduced from the definition of covariance must be taken into account:

  • Cov (X, b) = 0, b being in this case a constant.
  • Cov (X, X) = Var (X) that is, the covariance of a variable and of itself is equal to the variance of the variable.
  • Cov (X, Y) = Cov (Y, X) the covariance is the same, regardless of the order in which we put them.
  • Cov (b · X, c · Y) = c · b · Cov (X, Y) where b and c are two constants. The covariance of two variables multiplied by any two constants is equal to the covariance of the two variables multiplied by the multiplication of the constants.
  • Cov (b + X, c + Y) = Cov (X, Y) add any two constants to each variable, it does not affect the covariance.
  • Cov (X, Y) = E (X · Y) – E (X) · E (Y) or what is the same, the covariance is equal to the expectation of the product of the two variables minus the product of the two hopes separately.

Expanding the previous properties, in case two variables are independent. That is, they have no statistical relationship, it is true that:

E (X · Y) = E (X) · E (Y)

That is to say that the hope of the product of two variables is equal to the product of the two hopes separately of these variables.

Covariance example

Suppose we have the following data from X and Y.

How do we interpret this 4?

This 4 is telling us, being greater than zero, that these two variables have a positive relationship. To know the adjusted relationship between the two variables we should calculate the linear correlation . Two covariances of different variables are not comparable, since the value of the covariance is an absolute value that depends on the unit of measure of the variables.

Leave a Comment