不偏標本分散

定義:unbiased sample variance

大きさが $n$ である標本 $x_1, x_2, \cdots, x_n$ に対して,\[s^2 = \frac{1}{n-1} \sum_{i=1}^n (x_i - \bar{x})^2\]を不偏標本分散という.

$(n-1)$ は自由度の補正,もしくは,ベッセルの補正と言われる.これは,$n$ で割ると,母分散を過小評価してしまうことを補正するものである.

以下で補正が必要になる理由を示す.まず,$\bar{X} = \frac{1}{n}\sum_{i=1}^n X_i$ であることから,\[\begin{eqnarray}E\left[\frac{1}{n} \sum_{i=1}^n (X_i - \bar{X})^2\right]&=& \frac{1}{n} E\left[\sum_{i=1}^n (X_i - \bar{X})^2\right] \\&=& \frac{1}{n} E\left[\sum_{i=1}^n (X_i^2 - 2X_i\bar{X} + \bar{X}^2)\right] \\&=& \frac{1}{n} E\left[\sum_{i=1}^n X_i^2 - 2\bar{X}\sum_{i=1}^n X_i + n\bar{X}^2\right] \\&=& \frac{1}{n} E\left[\sum_{i=1}^n X_i^2 - 2n\bar{X}^2 + n\bar{X}^2\right] \\&=& \frac{1}{n} E\left[\sum_{i=1}^n X_i^2 - n\bar{X}^2\right]\end{eqnarray}\]ここで, $E[X_i^2] = \sigma^2 + \mu^2$ と $E[\bar{X}] = \mu$ を用いると,\[\begin{eqnarray}E\left[\sum_{i=1}^n X_i^2 - n\bar{X}^2\right]&=& \frac{1}{n} \left[n(\sigma^2 + \mu^2) - nE[\bar{X}^2]\right] \\&=& (\sigma^2 + \mu^2) - E[\bar{X}^2]\end{eqnarray}\]次に,$\bar{X}$ の分散を考える.$Var(\bar{X}) = \frac{\sigma^2}{n}$ であることを用いると,\[\begin{eqnarray}Var(\bar{X}) &=& E[(\bar{X} - \mu)^2] = E[\bar{X}^2] - \mu^2 = \frac{\sigma^2}{n} \\E[\bar{X}^2] &=& \frac{\sigma^2}{n} + \mu^2\end{eqnarray}\]これを先の式に代入する.\[\begin{eqnarray} (\sigma^2 + \mu^2) - E[\bar{X}^2]&=& (\sigma^2 + \mu^2) - (\frac{\sigma^2}{n} + \mu^2) \\&=& \sigma^2 - \frac{\sigma^2}{n} \\&=& \frac{n\sigma^2 - \sigma^2}{n} \\&=& \frac{(n-1)\sigma^2}{n}\end{eqnarray}\]すなわち,標本分散期待値が真の分散の $\frac{n-1}{n}$ 倍になっている.この補正のために $n-1$ で割っているのである.

射影行列を用いたベッセルの補正の導出

まず, $\sum_{i=1}^n (x_i - \bar{x})^2$ をベクトル表記で書き直すと,\[\sum_{i=1}^n (x_i - \bar{x})^2 = (\mathbf{x} - \bar{x}\mathbf{1})^T(\mathbf{x} - \bar{x}\mathbf{1})\]となる.ここで,$\mathbf{x} = (x_1, \ldots, x_n)^T$ であり, $\mathbf{1}$ は全ての要素が1の$n$次元ベクトルである.

$\bar{x}$ の定義 $\bar{x} = \frac{1}{n}\sum_{i=1}^n x_i$ を使うと,\[\bar{x}\mathbf{1} = \frac{1}{n}(\sum_{i=1}^n x_i)\mathbf{1} = \frac{1}{n}\mathbf{1}\mathbf{1}^T\mathbf{x}\]ここで,射影行列 $\mathbf{P}$ を導入する.\[\mathbf{P} = \frac{1}{n}\mathbf{1}\mathbf{1}^T\]これを用いて元の式を書き換えると,\[\sum_{i=1}^n (x_i - \bar{x})^2 = (\mathbf{x} - \mathbf{P}\mathbf{x})^T(\mathbf{x} - \mathbf{P}\mathbf{x})\]右辺を展開する.\[(\mathbf{x} - \mathbf{P}\mathbf{x})^T(\mathbf{x} - \mathbf{P}\mathbf{x}) = \mathbf{x}^T\mathbf{x} - \mathbf{x}^T\mathbf{P}\mathbf{x} - \mathbf{x}^T\mathbf{P}\mathbf{x} + \mathbf{x}^T\mathbf{P}^T\mathbf{P}\mathbf{x}\]$\mathbf{P}$ の性質($\mathbf{P}^T = \mathbf{P}$, $\mathbf{P}^2 = \mathbf{P}$)を用いると,\[\mathbf{x}^T\mathbf{x} - 2\mathbf{x}^T\mathbf{P}\mathbf{x} + \mathbf{x}^T\mathbf{P}\mathbf{x} = \mathbf{x}^T(\mathbf{I} - \mathbf{P})\mathbf{x}\]ここで,$\mathbf{I} - \mathbf{P}$ も射影行列であることに注目する.この行列のトレースを計算すると,\[\text{tr}(\mathbf{I} - \mathbf{P}) = \text{tr}(\mathbf{I}) - \text{tr}(\mathbf{P}) = n - \frac{1}{n}\text{tr}(\mathbf{1}\mathbf{1}^T) = n - 1\]このことは,$\mathbf{I} - \mathbf{P}$ が $n-1$ 次元の部分空間への射影を表していることを意味している.

結果として,$\sum_{i=1}^n (x_i - \bar{x})^2$ は次のように表現できる.\[\sum_{i=1}^n (x_i - \bar{x})^2 = \mathbf{x}^T(\mathbf{I} - \mathbf{P})\mathbf{x}\]ここで,$\mathbf{I} - \mathbf{P}$ は $n-1$ 次元の部分空間への射影を表している.したがって,不偏推定量を得るためには,この和を $(n-1)$ で割る必要がある.すなわち,\[s^2 = \frac{1}{n-1}\sum_{i=1}^n (x_i - \bar{x})^2 = \frac{1}{n-1}\mathbf{x}^T(\mathbf{I} - \mathbf{P})\mathbf{x}\]

Mathematics is the language with which God has written the universe.





















不偏標本分散 標本 条件付き分散 条件付き期待値 偏相関係数 相関