5- Covariance
In probability theory and statistics, covariance is a measure of the joint variability of two random variables.
If the greater values of one variable mainly correspond with the greater values of the other variable,
and the same holds for the lesser values, (i.e., the variables tend to show similar behavior),
the covariance is positive. In the opposite case, when the greater values of one variable mainly
correspond to the lesser values of the other, (i.e., the variables tend to show opposite behavior),
the covariance is negative. The sign of the covariance therefore shows the tendency in the linear relationship between the variables.
For two jointly distributed real-valued random variables π and π,
the covariance is defined as the expected value (or mean) of the product of their deviations from their individual expected values:
cov(π,π)=πΈ[(π−πΈ(π))(π−πΈ(π))]
where πΈ(π) is the expected value of π, also known as the mean of π.
The covariance is also sometimes denoted πΰ―ΰ― or π(π,π), in analogy to variance. By using the linearity property of expectations,
this can be simplified to the expected value of their product minus the product of
their expected values:
cov(π,π)=πΈ[(π−πΈ(π))(π−πΈ(π))]
=πΈ[ππ−ππΈ(π)−πΈ(π)π+πΈ(π)πΈ(π)]
=πΈ[ππ]−πΈ(π)πΈ(π)−πΈ(π)πΈ(π)+πΈ(π)πΈ(π)]
=πΈ(ππ)−πΈ(π)πΈ(π)
Covariance of discrete random variables:
If the random variable pair (πΏ,π) can take on the values (ππ,ππ) for π=π,β―,π, with equal
probabilities ππ= then the covariance can be equivalently written in terms of the means π¬(πΏ) and π¬(π) as
More generally, if there are n possible realizations of (π,π),
namely (ππ,ππ) but with possibly unequal probabilities ππ for π=π,β―,π, then the covariance is
Suppose that π and π have the following joint probability mass function:
(π₯,π¦)∈π={(5,8),(6,8),(7,8),(5,9),(6,9),(7,9)}with probability respectively{0,0.4,0.1,0.3,0,0.2}
Then we can deduce that π can take on three values (5, 6 and 7) with probability respectively (0.3,0.4,0.3)
and π can take on two (8 and 9) with probability respectively (0.5, 0.5).
So
πΈ(π)=5(0.3)+6(0.4)+7(0.1+0.2)=6
And
πΈ(π)=8(0.4+0.1)+9(0.3+0.2)=8.5
Then,
=(0)(5−6)(8−8.5)+(0.4)(6−6)(8−8.5)+
(0.1)(7−6)(8−8.5)+(0.3)(5−6)(9−8.5)+
(0)(6−6)(9−8.5)+(0.2)(7−6)(9−8.5)=−0.1
the variance is a special case of the covariance in which the two variables are identical
(that is, in which one variable always takes the same value as the other):
cov(X,X)=Var(X)=
Covariance of linear combinations
If π,π,π,πππ π are real-valued random variables and π,π,π,π are real-valued constants,
then the following facts are a consequence of the definition of covariance:
cov(X,a)=0
cov(X,X)=Var(X)
cov(X,Y)=cov(Y,X)
cov(a X,b Y)=a b cov(X,Y)
cov(X+a,Y+b)=cov(X,Y)
πππ£(ππ+ππ,ππ+ππ)=ππ πππ£(π,π)+ππ πππ£(π,π)+ππ πππ£(π,π)+ππ πππ£(π,π)
For a sequence of random variables in real-valued,
and constants , we have