- Step2. 中級編
- 1. 2×2のクロス集計表と様々な比率
1-6. コクラン=アーミテージ検定
コクラン=アーミテージ検定は、順序尺度からなる順序データと2値データからなるクロス集計表があるときに、順序データの水準に伴う2値データの傾向性があるかどうかを検定する場合に用います。
例えば、順序データ()と2値データ(
)からなるクロス集計表の場合、順序データの各水準における
の割合(
)に直線的な増加もしくは減少の傾向があるかを検定します。
![]() | ![]() | 合計 | |
---|---|---|---|
![]() | a | b | a+b |
![]() | c | d | c+d |
![]() | e | f | e+f |
少し分かりにくいので具体例をあげてみます。お酒を「飲まない」、「少し飲む」、「たくさん飲む」人の中で、肥満の割合を調べた結果について考えてみます。
肥満である | 肥満ではない | 合計 | 肥満の割合 | |
---|---|---|---|---|
お酒を飲まない | 10 | 90 | 100 | 10% |
お酒を少し飲む | 20 | 60 | 80 | 25% |
お酒をたくさん飲む | 30 | 30 | 60 | 50% |
この例では「肥満である」の割合に傾向があるかを検定します。すなわち、X軸にお酒を飲む量の水準を、Y軸に肥満の割合を取ったとったときに、回帰直線の傾きが0でない場合には、お酒を飲む量が増えるにつれて肥満の割合が有意に増加(もしくは減少)すると結論付けられます。
![](https://bellcurve.jp/statistics/wp-body/wp-content/uploads/2022/10/795316b92fc766b0181f6fef074f03fa.png)
■計算方法
順序尺度からなる順序データ()と2値データ(
)からなる次のような結果について考えます。
![]() | ![]() | 合計 | 割合 | |
---|---|---|---|---|
![]() | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() | ![]() |
︙ | ︙ | ︙ | ︙ | ︙ |
![]() | ![]() | ![]() | ![]() | ![]() |
合計 | ![]() | ![]() | ![]() | ![]() |
コクラン=アーミテージ検定では、この結果から次のようなカイ二乗値を計算します。 の値は順序データの値をそのまま使う場合や
という値を用いる場合もあります。
カイ二乗値 | 自由度 | |
---|---|---|
直線の傾き | ![]() | ![]() |
直線からのズレ | ![]() | ![]() |
合計 | ![]() | ![]() |
まず、3つの平方和()を計算します。
![Rendered by QuickLaTeX.com \displaystyle S_{xx} = \sum_{i=1}^{k} n_i w (x_i-\bar{x})^2](https://bellcurve.jp/statistics/wp-body/wp-content/ql-cache/quicklatex.com-af9380d56d769a871df3b6413da2179f_l3.png)
![Rendered by QuickLaTeX.com \displaystyle S_{yy} = \sum_{i=1}^{k} n_i w (p_i - p)^2](https://bellcurve.jp/statistics/wp-body/wp-content/ql-cache/quicklatex.com-ceebcab1d9f3e2f3cc3689efcc991eda_l3.png)
![Rendered by QuickLaTeX.com \displaystyle S_{xy} = \sum_{i=1}^{k} n_i w (x_i-\bar{x})(p_i - p)](https://bellcurve.jp/statistics/wp-body/wp-content/ql-cache/quicklatex.com-f67625869d796540d4113d0d982337dd_l3.png)
ただし、 と
は次の式から算出します。
![Rendered by QuickLaTeX.com \displaystyle w = \frac{1}{p(1-p)}](https://bellcurve.jp/statistics/wp-body/wp-content/ql-cache/quicklatex.com-6ac7d5decd64b0dc95ecc21b388b4015_l3.png)
![Rendered by QuickLaTeX.com \displaystyle \bar{x} = \frac{\sum n_i x_i}{n}](https://bellcurve.jp/statistics/wp-body/wp-content/ql-cache/quicklatex.com-908ce6e7d41740be6a08e9a1daaa497f_l3.png)
次に、これらの平方和から各カイ二乗値を計算します。
![Rendered by QuickLaTeX.com \displaystyle \chi^2_{slope} = \frac{S^2_{xy}}{S_{xx}}](https://bellcurve.jp/statistics/wp-body/wp-content/ql-cache/quicklatex.com-23b726160c829b45ed989b062ac89b09_l3.png)
![Rendered by QuickLaTeX.com \displaystyle \chi^2_{total} = S_{yy}](https://bellcurve.jp/statistics/wp-body/wp-content/ql-cache/quicklatex.com-2d36dc94f68a143e98e5b755b322f3f2_l3.png)
![Rendered by QuickLaTeX.com \displaystyle \chi^2_{residual} = S_{total} - S_{slope}](https://bellcurve.jp/statistics/wp-body/wp-content/ql-cache/quicklatex.com-b3cbfbeebb494a5e4b7bc2ce4657c028_l3.png)
カイ二乗値と自由度から検定を行います。 を使ったカイ二乗検定の結果が、直線の傾き
であるかどうかの検定結果です。
例題:
上であげたお酒を飲む量と肥満の割合との関係についてまとめた結果を使って、お酒を飲む量に対して肥満の割合に傾向があるかどうかを検証し、結論を導き出してください。有意水準を5%とします。
肥満である | 肥満ではない | 合計 | 肥満の割合 | |
---|---|---|---|---|
お酒を飲まない | 10 | 90 | 100 | 10% |
お酒を少し飲む | 20 | 60 | 80 | 25% |
お酒をたくさん飲む | 30 | 30 | 60 | 50% |
ここでは、お酒を飲む量の各水準を「お酒を飲まない=1」、「お酒を少し飲む=2」、「お酒をたくさん飲む=3」として計算します。
肥満である | 肥満ではない | 合計 | 肥満の割合 | |
---|---|---|---|---|
1 | 10 | 90 | 100 | 10% |
2 | 20 | 60 | 80 | 25% |
3 | 30 | 30 | 60 | 50% |
合計 | 60 | 180 | 240 | 25% |
まず、3つの平方和()を計算します。
![Rendered by QuickLaTeX.com \displaystyle w = \frac{1}{0.25(1-0.25)} = 5.33](https://bellcurve.jp/statistics/wp-body/wp-content/ql-cache/quicklatex.com-8556d3c9202c955206c2186477802d07_l3.png)
![Rendered by QuickLaTeX.com \displaystyle \bar{x} = \frac{\sum n_i x_i}{n} = \frac{1 \times 100 + 2 \times 80 + 3 \times 60}{240} = \frac{440}{240} = 1.83](https://bellcurve.jp/statistics/wp-body/wp-content/ql-cache/quicklatex.com-b089e030ba7a4e11ace08399115d80b7_l3.png)
であることから
![Rendered by QuickLaTeX.com \displaystyle S_{xy} &=& \sum_{i=1}^{k} n_i w (x_i-\bar{x})(p_i - p) \\ &=& 100 \times 5.33(1-1.83)(0.1-0.25) + 80 \times 5.33(2-1.83)(0.25-0.25) + 60 \times 5.33(3-1.83)(0.5-0.25) \\ &=& 159.90 \\ \end{eqnarray*}](https://bellcurve.jp/statistics/wp-body/wp-content/ql-cache/quicklatex.com-91f74afd0d76c8e126d49144ed14944a_l3.png)
となります。これらの平方和から各カイ二乗値を計算すると
![Rendered by QuickLaTeX.com \displaystyle \chi^2_{slope} = \frac{S^2_{xy}}{S_{xx}} = \frac{159.90^2}{817.28} = 31.28](https://bellcurve.jp/statistics/wp-body/wp-content/ql-cache/quicklatex.com-8d3fe0cb2a90673ac59f6325069f315b_l3.png)
![Rendered by QuickLaTeX.com \displaystyle \chi^2_{total} = S_{yy} = 31.98](https://bellcurve.jp/statistics/wp-body/wp-content/ql-cache/quicklatex.com-98e0d1774e57eeb4967bc1748765f8f7_l3.png)
![Rendered by QuickLaTeX.com \displaystyle \chi^2_{residual} = S_{total} - S_{slope} = 31.98 - 31.28 = 0.70](https://bellcurve.jp/statistics/wp-body/wp-content/ql-cache/quicklatex.com-ef39e563509717284f330eb72649048a_l3.png)
となります。カイ二乗値と自由度から検定を行うと次のようになります。
カイ二乗値 | 自由度 | 検定結果 | |
---|---|---|---|
直線の傾き | 31.28 | ![]() | 有意である |
直線からのズレ | 0.70 | ![]() | 有意ではない |
合計 | 31.98 | ![]() | 有意である |
を使ったカイ二乗検定の結果が、直線の傾き
であるかどうかの検定結果です。したがって、「お酒を飲む量と肥満の割合には直線的な傾向が見られる(お酒を飲む量が増えると肥満の割合が増加する)」と結論づけられます。