0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【統計検定2級/学習メモ】2群間の平均の差の検定(対応がある場合)

Last updated at Posted at 2025-05-11

※参考書の説明が若干不親切だったので自分用に噛み砕いたものをメモ。

対応のある2群間(ここではわかりやすくBeforeとAfter)の平均の差の検定を考える。

$d_i=x_{Ai}-x_{Bi}$ の平均 $\bar{d}(= \frac{1}{n}\sum{(x_{Ai}-x_{Bi})} = \frac{1}{n}\sum{d_i})$ と 標準偏差 $\hat{\sigma_d}$ を計算し、標準化変量を求める。

まず、$d$ と $\bar{d}$ は、$X \sim \mathcal{N}(\mu, \sigma^2)$ と $\bar{X} \sim \mathcal{N}(\mu, \frac{\sigma^2}{n})$ と同じノリ(?)で、以下の確率分布に従う。

$$d \sim \mathcal{N(\mu_d, \sigma_d^2)}$$

$$\bar{d} \sim \mathcal{N(\mu_d, \frac{\sigma_d^2}{n})}$$

個々の測定値 $x_{Ai} , x_{Bi}$が正規分布から抽出されている必要はなくて、あくまで差分だけが正規分布に従っていればよいという点がポイント。
正規性が怪しい場合は、シンプルに中心極限定理から $\bar{d}$ が上記の正規分布に従うことを考えれば良い。

正規性を前提にしているので、標準化変量が求められる。

$$z_{\bar{d}} = \frac{\bar{d}-\mu_{d}}{\sigma_{\bar{d}}} = \frac{\bar{d}-\mu_{d}}{\sqrt{\frac{\sigma_d^2}{n}}}$$

ここで、検定するときは、帰無仮説は $H_o : \mu_A = \mu_B$ つまり $H_o : \mu_A - \mu_B =0$ だから、帰無仮説が正しいと仮定した場合の $\mu_d$ は以下のように示せる。

$$\mu_d = E[d_i] = E[x_{Ai}-x_{Bi}] = E[x_A] - E[x_B] = \mu_A - \mu_B = 0$$

よって、帰無仮説の下では $\mu_d = 0$ だから、検定統計量 $z_{\bar{d}}$ は、

$$z_{\bar{d}} = \frac{\bar{d}}{\sqrt{\frac{\sigma_d^2}{n}}}$$

※ 念の為、$\sigma_d^2 = \frac{\sum{(d_i-\mu_d)^2}}{n}$ となる。

上記は、母分散が既知の場合での記述。普通に考えると母分散は未知なのが当たり前。
母分散が未知の場合の $t$検定の統計量も、同じ要領で以下のように表せる。

$$ t_{\bar{d}}=\frac{\bar{d}-\mu_d}{\sqrt{\frac{\hat{\sigma_d}^2}{n}}} → t_{\bar{d}}=\frac{\bar{d}}{\sqrt{\frac{\hat{\sigma_d}^2}{n}}} $$

※念の為、$\hat{\sigma}^2 = \frac{\sum{(d_i-\bar{d})^2}}{n-1}$ となる。

自由度は、BeforeとAfterの2群でペアとなっている個体数 $n$ から1を引いた値( $\nu = n-1$ )になる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?