アンケートや実験などにおいて、2つのデータ群の関連性を判定する検定.例えば,2つのデータ群が独立である (関連がない) という仮説を立てておき,そうなる確率 (p値) が極めて低いときは 独立でない (関連がある) と判定して仮説を棄却する.
具体的には,データ→期待度数→カイ二乗検定統計量(カイ二乗値)→p値を求め,有意水準5%の場合,p値が0.05より大きければ独立である (関連がない) と判定する.
◆ Oxford AI SL P396 Q2 より
A survey was conducted to find out which type of bread males and females prefer. Eighty people were interviewed outside a baker's shop and the results are shown below.
Using the x2 test at the 5% significance level, determine whether the favourite type of bread is independent of gender.
a) State the null hypothesis and the alternative hypothesis.
$H_0$ : 帰無仮説 性別と好きなパンの種類は独立である(関連がない)
$H_1$ : 対立仮説 性別と好きなパンの種類は独立でない(関連がある)
b) Show that the expected frequency for female and white bread is approximately 15.9.
女性で白い小麦粉のパンが好きな人の期待度数は $$\frac{41}{80}\times\frac{31}{80}\times 80=15.8875≒15.9$$
c) Write down the number of degrees of freedom.
$(4-1)(2-1)=3×1=3$
d) Write down the $\chi ^2$ test statistic and the p-value for this data. The critical value is 7.815.
critical value (臨界値) とは,「偶然では起きにくいと判断する境界線の値」 のことで,この場合は自由度3のときの値.
Excelでいきなりp値を求めるには,CHISQ.TEST(観測値の配列,期待度数の配列)を使えばp=0.548165119 が得られる.
e) Comment on your result.
この場合,2.12<7.815 i.e. 0.548>0.05 なので,帰無仮説は棄却されず,性別と好きなパンの種類は独立である(関連がない)
As part of a study into colour preference, Alicia surveyed 100 students at her school. She recorded each student's gender, and their favourite colour from blue, red, brown or black. Alicia's results are shown in the table below.
Alicia conducted a $\chi ^2$ test for independence at a 5% level of significance.
a) State the null hypothesis.
$H_0$ : Favourite colour is independent of gender.
b) Write down the associated p-value.
Excelでいきなりp値を求めるには,CHISQ.TEST(観測値の配列,期待度数の配列)を使えばp=0.0276434が得られる.
c) State, giving a reason, whether the null hypothesis should be accepted.
0.0276<0.05 なので,reject $H_0$ i.e. 好みの色と性別は独立でない(関連がある)