Covariance is a statistical value that indicates the variation produced by two random variables that vary jointly with respect to their means. That is, we will know how one variable behaves depending on how the other does.
En statistics Two values are used to represent each of the variables: X and Y [their covariance is represented as COV (X, Y)]. Depending on what one of the two variables does, the other variable will behave in one way or another. We see it below:
Covariance (X, Y) <0: happens when X goes up and Y goes down. There is a negative relationship.
Covariance (X, Y)> 0: happens when X goes up and Y goes up. There is a positive relationship.
Covariance (X, Y) = 0: happens when X goes up and Y goes down. There is no relationship between X and Y.
The formula to be able to calculate the covariance is:
- and with accent: mean of variable Y
- x with accent: mean of variable X
- i: observation position
- n: number of observations
Properties of covariance
Regarding the properties of the covariance, we find:
- COV (X, b) = 0, where b is a constant
- COV (X, X) = Var (X) The covariance of a variable and of itself is equal to the variance of the variable
- COV (X, Y) = COV (Y, X) The covariance will give the same result regardless of whether one variable is taken first than the other
- COV (b * X, c * Y = c * b * COV (X, Y) where b and c are constants
- COV (b + X, c + Y) = COV (X, Y) Adding two constants to the variables will not affect their covariance
- COV (X, Y) = E (X * Y) - E (X) * E (Y) The covariance is equal to the expectation of the product of the two variables minus the product of the expectations separately.