共分散
Contents
共分散とは
共分散 (英:covariance) とは、二種類のデータの関係を示す指標のこと。共分散は、それぞれの偏差の積の期待値により計算される。
\[ \begin{aligned} \mathrm{cov}(X,Y) &= E((X-E(X))(Y-E(Y))) \\ &= \begin{cases} \displaystyle\sum_x\sum_y (x-\mu_X)(y-\mu_Y)P(x,y) & \text{if discrete} \\ \displaystyle\iint(x-\mu_X)(y-\mu_Y)p(x,y)~dxdy & \text{if continuous} \\ \end{cases} \end{aligned} \]
$X-E(X)$ と $Y-E(Y)$ の正負の傾向から、次式の符号の関係を持つ。
\[ \mathrm{cov}(X,Y)~\begin{cases} \gt 0 & \cdots X,Y\text{ の符号が同傾向} \\ \lt 0 & \cdots X,Y\text{ の符号が反対傾向} \\ = 0 & \cdots X,Y\text{ は無相関} \\ \end{cases} \]
共分散の諸定理
\[ \begin{aligned} \text{(C1)} &: V(X+Y) = V(X)+V(Y)+2\mathrm{cov}(X,Y) \\ \text{(C2)} &: \mathrm{cov}(X,Y) = E(XY) - E(X)E(Y) \\ \end{aligned} \]
$\bold{(C1)}$ の証明:
\[ \begin{aligned} V(X)+V(Y)+2\mathrm{cov}(X,Y) &= E((X-E(X))^2) + E((Y-E(Y))^2) + 2E((X-E(X))(Y-E(Y))) \\ &= E((X-E(X))^2+(Y-E(Y))^2+2(X-E(X))(Y-E(Y))) \\ &= E(((X-E(X))+(Y-E(Y)))^2) \\ &= E(((X+Y)-E(X+Y))^2) \\ &= V(X+Y) \\ \\ \therefore V(X+Y) &= V(X)+V(Y)+2\mathrm{cov}(X,Y) \end{aligned} \]
$\bold{(C2)}$ の証明:
\[ \begin{aligned} \operatorname{cov}(X,Y) &= E((X-E(X))(Y-E(Y)) \\ &= E(XY - XE(Y) - YE(X) + E(X)E(Y)) \\ &= E(XY) - E(X)E(Y) - E(X)E(Y) + E(X)E(Y) \\ &= E(XY) - E(X)E(Y) \\ \\ \therefore \operatorname{cov}(X,Y) &= E(XY) - E(X)E(Y) \end{aligned} \]