09. Covariance
Definition¶
Intuitive definition¶
\(\covariant(X,Y)\) measures the likelihood of \(X,Y\) “moving in the same direction”.
If I know \(X\) is less than expected, what does that tell me about \(Y\)?
- Nothing; \(Y\) is still expected to be \(E[Y] \Rightarrow \covariant(X,Y)=0\)
- \(Y\) is also likely to be less than expected \(\Rightarrow \covariant(X,Y)>0\)
- \(Y\) is now likely to be more than expected \(\Rightarrow \covariant(X,Y)<0\)
- i.e., \(X,Y\) “tend to move” in different directions
Formal definition¶
Where \(\mu_1=E[X],\mu_2=E[Y]\)
Note that \(V(X)=\covariant(X,X)\)
A simpler formula:
Proof: Likely on the ProbabilityExam{: #ProbabilityExam .hash}
Properties of Covariance¶
- \(\covariant(aX,bY)=ab\cdot\covariant(X,Y)\)
- \(\covariant(a+X,b+Y)=\covariant(X,Y)\)
- For any \(X,Y\): \(V(X+Y)=V(X)+V(Y)+2\covariant(X,Y)\)
Proof of Property 3: Likely on the ProbabilityExam{: #ProbabilityExam .hash}
\(\(\begin{aligned}
V(X+Y)&=E[(X+Y)^2]-(\underbrace{E[X+Y]}_{\begin{aligned}(E[X]&+E[Y])\\(\mu_1&+\mu_2)\end{aligned}})^2
\\&=E[X^2+2XY+Y^2]-(\mu_1^2+2\mu_1\mu_2+\mu_2^2)
\\&=E[X^2]+2E[XY]+E[Y^2]-(\mu_1^2+2\mu_1\mu_2+\mu_2^2)
\\&=\textcolor{orange}{(E[X^2]-\mu_1^2)}+\textcolor{purple}{(E[Y^2]-\mu_2^2)}+\textcolor{blue}{2(E[XY]-\mu_1\mu_2)}
\\&=\textcolor{orange}{V(X)}+\textcolor{purple}{V(Y)}+\textcolor{blue}{2\covariant(X,Y)}
\\&Q.E.D.
\end{aligned}\)\)
Corollary of Property 3:
Pearson Correlation Coefficient¶
Definition¶
\(\rho(X,Y)\) is a normalized version of \(\covariant(X,Y)\).
\(-1\le\rho(X,Y)\le1\) (Sign of \(\rho\) is the same sign of \(\covariant\))
- If \(\rho(X,Y)\) is close to 0, then the correlation between X,Y is weak
- If \(\rho(X,Y)\) is close to \(1\), then \(X,Y\) are strongly positively correlated
- \(X,Y\) have a strong tendency to move in the same direction
- If \(\rho(X,Y)\) is close to \(-1\), then \(X,Y\) are strongly negatively correlated
- \(X,Y\) have a strong tendency to move in opposite directions