SL 4.11 — Hypothesis testing: χ² and t-tests(仮説検定 — カイ二乗検定とt検定)

ノートWhat you should be able to do
  • null hypothesis \(H_0\)alternative hypothesis \(H_1\) を、英語で正しく書ける。
  • significance level(有意水準)と \(p\)-value が何を表すかを説明できる。
  • 3つの検定(\(\chi^2\) independence\(\chi^2\) goodness of fit\(t\)-test)を使い分けられる。
  • degrees of freedom(自由度)を求められる。
  • GDC で \(p\)-value と検定統計量を出せる。
  • \(p\)\(\alpha\)、または統計量と critical value を比べて、結論を文脈に戻して英語で書ける
重要Formula booklet には、何も載っていません

Topic 4 の欄は SL 4.8 で終わっています。 4.9(正規分布)、4.10(Spearman)、そしてこの 4.11 の式は、公式集に印刷されていません。

理由はシラバスに書いてあります。

students will be expected to use technology to find a \(p\)-value and the \(\chi^2\) statistic

つまり \(\chi^2\) の式を手で計算する問題は出ません。 電卓が出してくれます。

さらに、こうも書かれています。

the \(\chi^2\) critical value will be given if appropriate

critical value も問題文に書いてあります。 表を覚える必要も、探す必要もありません。

警告この項目は「計算」ではなく「記述」で点が決まります

シラバスの \(t\)-test の欄に、こう書かれています。

Students will be asked to interpret the results of a test.

電卓が \(p\)-value を出したあと、それを言葉にするところが採点対象です。数値だけ書いて終わると、ほとんど点になりません。

この本では、書くべき英文を型として全部載せます。

The idea

ヒント電卓を開きながら、このページを読んでください

この項目は、電卓の Stat Tests を開いた状態で読むのが一番わかりやすいです。まず電卓を出してください。

Lists & Spreadsheet ページか Calculator ページで、

menu → Statistics → Stat Tests

一覧の中に χ² 2-way Testχ² GOF2-Sample t Test の3つがあるのを確認してください。

このページで扱うのは、この3つだけです。 ほかにもたくさん並んでいますが、AI SL では使いません。

仮説検定とは何をすることか

手元にデータがあって、何かの差や関係が見えたとします。

このクラスの平均点は、隣のクラスより \(5\) 点高かった。

このとき問いたいのは、「その差は本物か、それともたまたまか」です。

hypothesis test(仮説検定)は、この問いに答えるための手続きです。考え方はこうです。

まず「差はない」と仮定してみる。 その仮定のもとで、手元のようなデータが出る確率を計算する。その確率がとても小さければ、最初の仮定のほうが疑わしい。

「差はない」という仮定が null hypothesis(帰無仮説、\(H_0\))、その確率が \(p\)-value です。

5つのステップ

どの検定でも、やることは同じ5つです。 これを覚えてしまえば、あとは電卓の操作が変わるだけです。

表 1: 仮説検定の5ステップ
ステップ 英語で
1 \(H_0\)\(H_1\) を書く State the hypotheses
2 有意水準 \(\alpha\) を確認する State the significance level
3 電卓で \(p\)-value(と統計量)を出す Use the GDC
4 \(p\)\(\alpha\) を比べる Compare
5 文脈に戻して結論を書く Conclude in context

5番が一番大事です。ここを書かないと、1〜4が全部合っていても点になりません。

\(H_0\)\(H_1\) の書き方

シラバスにこう書かれています。

Students should express \(H_0\) and \(H_1\) as an equation or inequality, or in words as appropriate.

つまり言葉で書いても構いません。 記号にこだわらなくて大丈夫です。

表 2: \(H_0\)\(H_1\) の型
検定 \(H_0\) \(H_1\)
\(\chi^2\) independence The two variables are independent. The two variables are not independent.
\(\chi^2\) goodness of fit The data fit the proposed distribution. The data do not fit the proposed distribution.
\(t\)-test(両側) \(\mu_1 = \mu_2\) \(\mu_1 \neq \mu_2\)
\(t\)-test(片側) \(\mu_1 = \mu_2\) \(\mu_1 > \mu_2\)(または \(<\)
重要\(H_0\) はいつも「差がない」「関係がない」ほう

\(H_0\) は、否定したい退屈なほうを書きます。「何も起きていない」という仮定です。

\(H_1\) は、主張したいほうです。「関係がある」「平均が違う」。

逆に書くと、以降の判定が全部ひっくり返ります。 一番よくある間違いなので、書いたあとに「\(H_0\) は退屈なほうか?」と1回確かめてください。

significance level と \(p\)-value

significance level(有意水準、\(\alpha\))は、どのくらい珍しければ「たまたまではない」と判断するかの基準です。問題文に必ず書いてあります。

シラバスによれば、試験で使われるのは次の3つだけです。

only questions on upper tail tests with commonly-used significance levels (1%, 5%, 10%) will be set

\(p\)-value は、\(H_0\) が正しいと仮定したときに、今回と同じ程度またはそれ以上に極端な結果が出る確率です。

\(p\) が小さいほど、\(H_0\) のもとでは今回の結果は珍しい、ということになります。だから \(H_0\) が疑わしくなります。

判定のルール

比べるものは2通りあります。 どちらも問題文の指示に従ってください。

重要\(p\)-value で判定する(こちらが基本)

\[ p \leq \alpha \quad \Longrightarrow \quad \textbf{reject } H_0 \]

\[ p > \alpha \quad \Longrightarrow \quad \textbf{do not reject } H_0 \]

\(p\) が小さいと reject」です。向きを覚えてください。\(p\) が小さい=\(H_0\) のもとではめったに起きない=\(H_0\) が怪しい、という流れです。

重要critical value で判定する(\(\chi^2\) のとき)

\[ \chi^2_{\text{calc}} \geq \chi^2_{\text{crit}} \quad \Longrightarrow \quad \textbf{reject } H_0 \]

\[ \chi^2_{\text{calc}} < \chi^2_{\text{crit}} \quad \Longrightarrow \quad \textbf{do not reject } H_0 \]

\(p\) のときと向きが逆です。統計量(\(\chi^2_{\text{calc}}\))は大きいほど \(H_0\) が怪しくなります。

この統計量は、観測度数と期待度数のずれを、すべて足し合わせたものです。ずれが大きいほど値も大きくなります。

critical value は問題文に与えられます。

警告「accept \(H_0\)」と書いてはいけません

\(p > \alpha\) のとき、正しい言い方は do not reject \(H_0\) です。

accept H₀ や「\(H_0\) が正しいと分かった」と書くと、点になりません。

理由は、検定が証明ではないからです。「\(H_0\) を否定するだけの証拠が集まらなかった」だけで、\(H_0\) が正しいと示したわけではありません。「無罪」と「やっていないことの証明」が違うのと同じです。

英語の型を、そのまま覚えてください。

  • reject するとき … There is sufficient evidence at the 5% level to reject \(H_0\).
  • reject しないとき … There is insufficient evidence at the 5% level to reject \(H_0\).

3つの検定の使い分け

どの検定を使うかは、データの形で決まります。

表 3: 3つの検定の使い分け
検定 何を調べるか データの形 自由度
\(\chi^2\) test for independence 2つのカテゴリに関係があるか 表(contingency table) \((r-1)(c-1)\)
\(\chi^2\) goodness of fit データが予想した割合に合うか 観測度数と期待度数のリスト \(n - 1\)
\(t\)-test 2つのグループの平均が違うか 数値データ2組 電卓が出す

見分け方は1つだけです。 矢印の先が、電卓で選ぶものです。

  • 行にも列にもカテゴリがある表(男女 \(\times\) 好きな科目 など)が出てきたら → independenceχ² 2-way Test
  • 度数が一列に並んでいるだけで、「割合はこうなるはず」と書いてあったら → goodness of fitχ² GOF
  • 数値のリストが2組あって「平均」の話なら → \(t\)-test2-Sample t Test

\(\chi^2\) test for independence

2つのカテゴリを組み合わせた表を contingency table(分割表)といいます。

「もし関係がなかったら、こうなるはず」という度数を expected frequency(期待度数)といい、実際の observed frequency(観測度数)とどれだけずれているかを測ります。

\[ \text{expected} = \frac{\text{行の合計} \times \text{列の合計}}{\text{全体の合計}} \tag{1}\]

自由度は、行数を \(r\)、列数を \(c\) として

\[ \nu = (r-1)(c-1) . \tag{2}\]

ヒント試験に出る表の大きさは決まっています

シラバスに、こう書かれています。

  • the maximum number of rows or columns in a contingency table will be 4
  • the degrees of freedom will always be greater than one
  • expected frequencies will be greater than 5

つまり試験では、

  • 表は最大 \(4 \times 4\)
  • \(2 \times 2\) の表は出ません\(\nu = 1\) になってしまうため)
  • 期待度数が \(5\) 以下になる心配もありません

一番小さいのは \(2 \times 3\)\(\nu = 2\))です。

\(\chi^2\) goodness of fit

「サイコロは公平か」「商品の色の割合は \(2:3:5\) か」のように、あらかじめ決まった割合に合うかを調べます。

期待度数は、全体の個数にその割合を掛けて作ります。

自由度は、シラバスに明記されています。

At SL the degrees of freedom for the goodness of fit test will always be \(n-1\)

\(n\)カテゴリの数です。\(3\) 色なら \(\nu = 2\)、サイコロの \(6\) 面なら \(\nu = 5\) です。

\(t\)-test

2つのグループの平均が違うかどうかを調べます。シラバスの条件が細かいので、そのまま引きます。

At SL, samples will be unpaired, and population variance will always be unknown.

Students should know that the underlying distribution of the variables must be normal for the \(t\)-test to be applied. In examinations, students should assume that variance of the two groups is equal and therefore the pooled two-sample \(t\)-test should be used.

試験で使うのは、いつも同じ設定です。

  • unpaired(対応なし)… 2つのグループは別々の人・もの
  • pooled(プールした分散を使う)… 電卓の PooledYes にする
  • 元の分布 … \(t\)-test を使うには、\(2\) つの母集団が normal distribution(正規分布)に従うという条件が必要です。問題文で確かめてください

one-tailed(片側)か two-tailed(両側)かは、問題文で決まります。

表 4: 片側か両側か
問題文 \(H_1\) 電卓の設定
Is there a difference?(違いがあるか) \(\mu_1 \neq \mu_2\) 両側
Is A greater than B?(A のほうが大きいか) \(\mu_1 > \mu_2\) 片側
Is A less than B?(A のほうが小さいか) \(\mu_1 < \mu_2\) 片側

「違いがあるか」なら両側、「どちらが大きいか」なら片側です。

Why it works

ここでは、\(\chi^2\) という数が何を測っているのかだけを見ます。式を手で計算する問題は出ないので、意味だけつかめば十分です。

\(\chi^2\) は、こう定義されています。

\[ \chi^2 = \sum \frac{(\text{observed} - \text{expected})^2}{\text{expected}} \tag{3}\]

分子は「ずれ」です。 実際の度数が、期待した度数からどれだけ離れているか。\(2\) 乗しているのは、プラスのずれとマイナスのずれが打ち消し合わないようにするためです。

分母で割っているのは、大きさをそろえるためです。期待度数 \(100\) に対する \(10\) のずれと、期待度数 \(10\) に対する \(10\) のずれでは、後者のほうがずっと大きな異常です。

ですから、

  • ぴったり合っていれば \(\chi^2 = 0\)
  • ずれが大きいほど \(\chi^2\) が大きくなる

例 3 の数字で見てみましょう。期待度数が \(40, 60, 100\)、観測度数が \(32, 68, 100\) でした。

\[ \frac{(32-40)^2}{40} + \frac{(68-60)^2}{60} + \frac{(100-100)^2}{100} = 1.6 + 1.0667 + 0 = 2.667 \]

3つ目のカテゴリはぴったり合っているので、\(0\) です。何も足しません。

ノート\(p\)-value は「\(\chi^2\) がここまで大きくなる確率」

\(H_0\) が正しくても、偶然のせいで \(\chi^2\)\(0\) にはなりません。多少はずれます。

\(p\)-value は、「\(H_0\) が正しいと仮定したときに、\(\chi^2\) が今回の値以上になる確率」です。つまり「今回と同じ程度、またはそれ以上に極端な結果が出る確率」です。

\(\chi^2\) が大きいほど、その確率は小さくなります。だから \(\chi^2\) が大きい ⟺ \(p\) が小さい で、2つの判定ルールは同じことを言っています。

\(\chi^2\) は「大きいと怪しい」、\(p\) は「小さいと怪しい」。向きが逆になるのは、このためです。

Worked examples

問題文は英語です。意味が理解できなかったら、問題文の下の「日本語訳」を開いてください。解説は日本語です。

例題 1 A café records whether each customer orders tea or coffee, and their age group. The results are shown in the table below.

Under 30 30–50 Over 50
Tea 30 45 55
Coffee 70 55 45

A \(\chi^2\) test for independence is carried out at the \(5\%\) significance level.

(a) State the null and alternative hypotheses.

(b) Write down the number of degrees of freedom.

(c) Find the \(p\)-value for this test.

(d) State the conclusion of the test. Justify your answer.


重要計算の前に:どの検定か

表(contingency table)が出てきました。 ですから \(\chi^2\) test for independence です(表 3)。

\(2\)\(3\) 列なので、自由度は \((2-1)(3-1) = 2\)。シラバスどおり \(1\) より大きくなっています。

(a) 「関係がない」ほうが \(H_0\) です(表 2)。

\(H_0\): The type of drink ordered is independent of age group.

\(H_1\): The type of drink ordered is not independent of age group.

(b) 式 2 より

\[ \nu = (2-1)(3-1) = 2 \]

(c) 電卓に表を行列として入れて、χ² 2-way Test を実行します(GDCの使い方)。

\[ \chi^2 = 12.9 \ (3\text{ s.f.}), \qquad p = 0.00158 \ (3\text{ s.f.}) \]

(d) \(\alpha = 0.05\) と比べます。

\[ p = 0.00158 < 0.05 \]

\(p\) のほうが小さいので reject \(H_0\) です。ここで終わらず、文脈に戻します。

試験ではこう書く

Since \(p = 0.00158 < 0.05\), we reject \(H_0\). There is sufficient evidence at the \(5\%\) significance level to conclude that the type of drink ordered is not independent of age group.

\(p = 0.00158 < 0.05\) なので \(H_0\) を棄却します。有意水準 \(5\%\) において、注文される飲み物の種類は年齢層と独立ではない、と結論するのに十分な証拠があります。)

重要(d) の書き方が、この項目の本体です

必ず3つ入れてください。

  1. 数値の比較Since \(p = 0.00158 < 0.05\)
  2. 判定we reject \(H_0\)
  3. 文脈the type of drink is not independent of age group

3つ目を落とす生徒が非常に多いです。reject H₀ だけで止めると、何について結論したのかが伝わりません。

問題文に出てくる言葉(type of drinkage group)を、そのまま結論の文に入れてください。それが「文脈に戻す」ということです。

ノート解答例(答案用紙にはこう書く)

(a) \(H_0\): The type of drink ordered is independent of age group.

\(H_1\): The type of drink ordered is not independent of age group.

(b) \(\nu = (2-1)(3-1) = 2\)

(c) Using the GDC (\(\chi^2\) 2-way Test): \[\chi^2 = 12.9, \qquad p = 0.00158\]

(d) Since \(p = 0.00158 < 0.05\), we reject \(H_0\). There is sufficient evidence at the \(5\%\) significance level to conclude that the type of drink ordered is not independent of age group.

例題 2 A company tests four different advertisements. For each advertisement, it records whether people remembered the product afterwards.

Remembered Did not remember
Advert A 42 18
Advert B 35 25
Advert C 28 32
Advert D 25 35

A \(\chi^2\) test for independence is carried out at the \(5\%\) significance level. The critical value is \(7.815\).

(a) Find the expected frequency for people who remembered the product after seeing Advert A.

(b) Find the \(\chi^2\) statistic.

(c) State, with a reason, the conclusion of the test.


(a) 式 1 を使います。行の合計、列の合計、全体の合計を読み取ります。

  • Advert A の行の合計 … \(42 + 18 = 60\)
  • Remembered の列の合計 … \(42 + 35 + 28 + 25 = 130\)
  • 全体の合計 … \(60 \times 4 = 240\)

\[ \text{expected} = \frac{60 \times 130}{240} = 32.5 \]

実際は \(42\) 人だったので、期待より \(9.5\) 人多かったことになります。

ヒント電卓でも確かめられます

χ² 2-way Test を実行したあと、var キーを押して、一覧から

stat.expmatrix

を選びます。期待度数の行列がそのまま出ます。 入力した表と行・列の並びが同じなので、Advert A の Remembered は左上の \(32.5\) です。

ただし、この設問は Find the expected frequency です。式を \(1\) 行書いてから答えてください。 電卓の数だけでは、過程の点が取れないことがあります(くわしくはこちら)。

(b) 電卓で χ² 2-way Test を実行します(GDCの使い方)。

\[ \chi^2 = 11.6 \ (3\text{ s.f.}) \]

(c) 今回は \(p\)-value ではなく critical value と比べます。 問題文が \(7.815\) を与えているからです。

\[ \chi^2 = 11.6 > 7.815 \]

統計量のほうが大きいので reject です。\(p\) のときと向きが逆なので注意してください。

試験ではこう書く

Since \(\chi^2 = 11.6 > 7.815\), we reject \(H_0\). There is sufficient evidence at the \(5\%\) significance level to conclude that whether people remember the product is not independent of which advertisement they saw.

\(\chi^2 = 11.6 > 7.815\) なので \(H_0\) を棄却します。有意水準 \(5\%\) において、人が商品を覚えているかどうかは、どの広告を見たかと独立ではない、と結論するのに十分な証拠があります。)

ヒントcritical value が問題文にあったら、それを使う

\(p\)-value でも同じ結論になります(\(p = 0.00883 < 0.05\))。どちらでも正解です。

ただし、問題文が critical value を与えているときは、それを使うのが自然です。わざわざ与えているのは「これと比べなさい」という合図だからです。

自由度が \((4-1)(2-1) = 3\) であることも確認しておいてください。critical value は自由度ごとに違うので、\(\nu = 3\) の値が与えられています。

ノート解答例(答案用紙にはこう書く)

(a) \[\text{expected} = \frac{60 \times 130}{240} = 32.5\]

(b) Using the GDC (\(\chi^2\) 2-way Test): \[\chi^2 = 11.6\]

(c) Since \(\chi^2 = 11.6 > 7.815\), we reject \(H_0\). There is sufficient evidence at the \(5\%\) significance level to conclude that whether people remember the product is not independent of which advertisement they saw.

例題 3 A company claims that its bags of sweets contain red, green and yellow sweets in the ratio \(2:3:5\). A sample of \(200\) sweets contains \(32\) red, \(68\) green and \(100\) yellow.

A \(\chi^2\) goodness of fit test is carried out at the \(5\%\) significance level.

(a) Find the expected frequencies.

(b) Write down the number of degrees of freedom.

(c) Find the \(p\)-value.

(d) State the conclusion of the test in context.


重要計算の前に:どの検定か

「割合はこうなるはず」という主張があります。 ですから goodness of fit です(表 3)。表ではなくリストなので、independence ではありません。

(a)\(2:3:5\) の合計は \(2+3+5 = 10\) です。\(200\) 個をこの割合で分けます。

\[ \text{red} = 200 \times \frac{2}{10} = 40, \quad \text{green} = 200 \times \frac{3}{10} = 60, \quad \text{yellow} = 200 \times \frac{5}{10} = 100 \]

(b) カテゴリが \(3\) つなので

\[ \nu = 3 - 1 = 2 \]

(c) 電卓で χ² GOF を実行します(GDCの使い方)。

\[ \chi^2 = 2.67 \ (3\text{ s.f.}), \qquad p = 0.264 \ (3\text{ s.f.}) \]

(d) \(\alpha = 0.05\) と比べます。

\[ p = 0.264 > 0.05 \]

今回は \(p\) のほうが大きいので、reject しません

試験ではこう書く

Since \(p = 0.264 > 0.05\), we do not reject \(H_0\). There is insufficient evidence at the \(5\%\) significance level to conclude that the sweets are not in the ratio \(2:3:5\).

\(p = 0.264 > 0.05\) なので \(H_0\) を棄却しません。有意水準 \(5\%\) において、お菓子が \(2:3:5\) の比になっていない、と結論するだけの証拠は十分ではありません。)

警告「会社の主張は正しいと分かった」と書かない

\(p > \alpha\) でも、会社の主張が証明されたわけではありません。

書けるのは「\(2:3:5\) ではない、と言えるだけの証拠が足りなかった」ということだけです。

  • The company’s claim is correct.
  • We accept \(H_0\).
  • There is insufficient evidence to reject \(H_0\).

この違いで点が決まります。 型のまま覚えてください。

ノート解答例(答案用紙にはこう書く)

(a) Total ratio \(= 2+3+5 = 10\)

\[\text{red} = 200 \times \tfrac{2}{10} = 40, \quad \text{green} = 60, \quad \text{yellow} = 100\]

(b) \(\nu = 3 - 1 = 2\)

(c) Using the GDC (\(\chi^2\) GOF): \[\chi^2 = 2.67, \qquad p = 0.264\]

(d) Since \(p = 0.264 > 0.05\), we do not reject \(H_0\). There is insufficient evidence at the \(5\%\) significance level to conclude that the sweets are not in the ratio \(2:3:5\).

例題 4 Two classes take the same test. Their scores are shown below.

Class A: \(72, \ 68, \ 75, \ 80, \ 66, \ 71, \ 78, \ 74, \ 69, \ 77\)

Class B: \(65, \ 70, \ 62, \ 68, \ 71, \ 64, \ 67, \ 60, \ 69, \ 66\)

A teacher wants to know whether there is a difference between the mean scores of the two classes. A \(t\)-test is carried out at the \(5\%\) significance level. It may be assumed that the scores are normally distributed and that the variances are equal.

(a) State the null and alternative hypotheses.

(b) Find the \(p\)-value.

(c) State the conclusion in context.


重要計算の前に:片側か両側か

whether there is a difference(違いがあるかどうか)と書かれています。どちらが大きいかは問われていません。

ですから two-tailed(両側) です(表 4)。電卓の Alternative Hyp\(\mu_1 \neq \mu_2\) を選びます。

(a)

\(H_0\): \(\mu_A = \mu_B\)The mean scores of the two classes are equal.

\(H_1\): \(\mu_A \neq \mu_B\)The mean scores of the two classes are not equal.

(b) 2つのリストを電卓に入れて、2-Sample t Test を実行します(GDCの使い方)。PooledYes です(シラバスの指定)。

\[ t = 3.71 \ (3\text{ s.f.}), \qquad p = 0.00159 \ (3\text{ s.f.}) \]

(c)

\[ p = 0.00159 < 0.05 \]

試験ではこう書く

Since \(p = 0.00159 < 0.05\), we reject \(H_0\). There is sufficient evidence at the \(5\%\) significance level to conclude that there is a difference between the mean scores of the two classes.

\(p = 0.00159 < 0.05\) なので \(H_0\) を棄却します。有意水準 \(5\%\) において、2つのクラスの平均点には違いがある、と結論するのに十分な証拠があります。)

ヒント平均を出しておくと、答えの検算になります

Class A の平均は \(73.0\)、Class B の平均は \(66.2\) で、\(6.8\) 点の差があります。

\(p\) が小さく出たのは、この差が大きいからです。もし平均がほとんど同じなのに \(p\) が小さく出たら、入力を間違えています。

平均は 2-Sample t Test の結果画面にも \(\bar{x}_1\)\(\bar{x}_2\) として表示されます。一度見ておく習慣をつけてください。

ノート解答例(答案用紙にはこう書く)

(a) \(H_0\): \(\mu_A = \mu_B\)    \(H_1\): \(\mu_A \neq \mu_B\)

(b) Using the GDC (2-Sample \(t\) Test, pooled, two-tailed): \[t = 3.71, \qquad p = 0.00159\]

(c) Since \(p = 0.00159 < 0.05\), we reject \(H_0\). There is sufficient evidence at the \(5\%\) significance level to conclude that there is a difference between the mean scores of the two classes.

例題 5 A gardener wants to test whether a new fertiliser makes plants taller. She grows \(8\) plants with the fertiliser and \(8\) plants without it, and measures their heights in cm after four weeks.

With fertiliser: \(23.6, \ 24.2, \ 22.9, \ 25.1, \ 23.8, \ 24.5, \ 22.7, \ 25.3\)

Without fertiliser: \(21.4, \ 23.1, \ 20.8, \ 22.5, \ 21.9, \ 20.2, \ 22.8, \ 21.1\)

A \(t\)-test is carried out at the \(1\%\) significance level. It may be assumed that the heights are normally distributed and that the variances are equal.

(a) State the null and alternative hypotheses.

(b) Find the \(p\)-value.

(c) State the conclusion in context.

(d) State one assumption that must be made for this test to be valid.


重要計算の前に:片側か両側か

makes plants taller(背が高くなる)と書かれています。向きが指定されています。

ですから one-tailed(片側) です(表 4)。\(\mu_1\) を肥料ありとして、\(H_1\)\(\mu_1 > \mu_2\) です。

有意水準も \(5\%\) ではなく \(1\%\) です。問題文をよく読んでください。

(a) \(\mu_1\) を肥料ありの平均、\(\mu_2\) を肥料なしの平均とします。

\(H_0\): \(\mu_1 = \mu_2\)

\(H_1\): \(\mu_1 > \mu_2\)

(b) 2-Sample t Test で、Alternative Hyp\(\mu_1 > \mu_2\) にします。PooledYes

\[ t = 4.63 \ (3\text{ s.f.}), \qquad p = 0.000193 \ (3\text{ s.f.}) \]

(c)

\[ p = 0.000193 < 0.01 \]

試験ではこう書く

Since \(p = 0.000193 < 0.01\), we reject \(H_0\). There is sufficient evidence at the \(1\%\) significance level to conclude that plants grown with the fertiliser are taller on average than plants grown without it.

\(p = 0.000193 < 0.01\) なので \(H_0\) を棄却します。有意水準 \(1\%\) において、肥料を与えた植物のほうが与えなかった植物より平均して背が高い、と結論するのに十分な証拠があります。)

(d) シラバスに書かれている仮定を1つ書けば十分です。

試験ではこう書く

The heights of the plants must be normally distributed.

(または The variances of the two populations must be equal.

重要リストの順番と \(H_1\) の向きをそろえる

片側検定では、どちらを \(\mu_1\) にしたかで \(H_1\) の向きが変わります。

肥料ありを List 1 に入れたなら \(H_1: \mu_1 > \mu_2\)、肥料なしを List 1 に入れたなら \(H_1: \mu_1 < \mu_2\) です。

逆にすると \(p\)\(1\) に近い値になります(今回なら \(p = 0.9998\))。\(p\) が異様に大きく出たら、まず向きを疑ってください。

答案には「\(\mu_1\) を肥料ありの平均とする」と一言書いておくと、採点者に伝わります。

ノート解答例(答案用紙にはこう書く)

Let \(\mu_1\) be the mean height with fertiliser and \(\mu_2\) the mean height without.

(a) \(H_0\): \(\mu_1 = \mu_2\)    \(H_1\): \(\mu_1 > \mu_2\)

(b) Using the GDC (2-Sample \(t\) Test, pooled, one-tailed): \[t = 4.63, \qquad p = 0.000193\]

(c) Since \(p = 0.000193 < 0.01\), we reject \(H_0\). There is sufficient evidence at the \(1\%\) significance level to conclude that plants grown with the fertiliser are taller on average.

(d) The heights must be normally distributed.

Common errors

警告\(H_0\)\(H_1\) を逆に書く

\(H_0\)いつも「差がない」「関係がない」ほうです(表 2)。

主張したいことを \(H_0\) に書いてしまうと、以降の判定が全部ひっくり返ります。書いたあとに「\(H_0\) は退屈なほうか?」と1回確かめてください。

警告accept H₀ と書く

正しくは do not reject \(H_0\) です。検定は \(H_0\) を証明する道具ではありません。

accept は英語の型として間違いなので、そのままでは点になりません。書き出しごと覚えてください。

There is insufficient evidence at the \(5\%\) level to reject \(H_0\).

警告結論を文脈に戻さない

reject H₀ だけで止めるのが、この項目で一番多い失点です。

問題文の言葉(type of drinkage groupmean scores など)を、必ず結論の文に入れてください。

型は3つセットです。数値の比較 → 判定 → 文脈。

警告\(p\)\(\chi^2\) で、比較の向きを取り違える
  • \(p\) は小さいと reject\(p \leq \alpha\)
  • \(\chi^2\) は大きいと reject\(\chi^2_{\text{calc}} \geq \chi^2_{\text{crit}}\)

向きが逆です。 どちらを使っているのかを、比べる前に確認してください。

迷ったら「\(p\) は確率だから、小さいほど珍しい=怪しい」と考え直してください。

警告自由度を間違える
  • independence … \(\nu = (r-1)(c-1)\)
  • goodness of fit … \(\nu = n - 1\)\(n\) はカテゴリの数)

\(\chi^2\) GOF では、電卓に自由度を自分で入力します。 ここを間違えると \(p\)-value が変わってしまいます。

independence のほうは電卓が自動で計算してくれます。

警告\(t\)-test で PooledNo にする

シラバスに students should assume that variance of the two groups is equal and therefore the pooled two-sample t-test should be used と明記されています。

Pooled は必ず Yes です。No にすると自由度も \(p\)-value も変わります。

試験前に、この設定を一度確認しておいてください。

警告片側と両側を取り違える
  • Is there a difference?両側
  • Is A greater / less than B?片側

片側なのに両側で計算すると、\(p\) がちょうど \(2\) 倍になります。ぎりぎりの問題では、それだけで結論が変わります。

問題文の動詞を見てください表 4)。

警告「significant」を「正しい」の意味で使う

\(p \leq \alpha\) で言えるのは「偶然では説明しにくい」ということだけです。「主張が真である」ことは示していません。

シラバスの TOK にも、こう書かれています。

In practical terms, is saying that a result is significant the same as saying it is true?

答えは No です。Comment onInterpret を求められたときに、この点に触れられると強いです。

Using your GDC (TI-Nspire CX II)

この項目は、電卓なしでは解けません。 シラバスが students will be expected to use technology to find a p-value and the χ² statistic と指定しています。

\(\chi^2\) test for independence

1. 行列を作る

Calculator ページで、テンプレートのパレット(9キーの右)を開き、行列のテンプレートを選びます。行数と列数を聞かれるので、表と同じ数(例 1 なら \(2\)\(3\) 列)を入れます。

点線のボックスが並ぶので、tab で移動しながら表の数字だけを入れます。行や列の合計は入れません。

\[ \begin{pmatrix} 30 & 45 & 55 \\ 70 & 55 & 45 \end{pmatrix} \]

2. 変数に入れる

入力した行列を、名前をつけて保存します。

(行列) → obs

矢印は ctrl + var で出ます。名前は obs でも a でも構いません。

3. 検定を実行する

menu → Statistics → Stat Tests → χ² 2-way Test

Observed Matrix の欄に obs と入れて OK

4. 結果を読む

表 5: \(\chi^2\) 2-way Test の結果
表示 意味
χ² 検定統計量
PVal \(p\)-value
df 自由度(自動で計算されます)
ExpMatrix 期待度数の行列

5. 期待度数の行列を出す

結果画面の ExpMatrix は、幅が足りなくて途中で切れて見えることがあります。全部を見るには、esc で結果画面を閉じてから、var キーを押します。

検定を実行すると、結果は stat. で始まる変数に自動で入っていますvar を押すと、その一覧が出てきます。

表 6: var で呼び出せるもの
一覧に出るもの 中身
stat.expmatrix 期待度数の行列
stat.χ² 検定統計量
stat.pval \(p\)-value
stat.df 自由度

stat.expmatrix を選んで enter を押すと、期待度数の行列が出ます。

\[ \begin{pmatrix} 32.5 & 27.5 \\ 32.5 & 27.5 \\ 32.5 & 27.5 \\ 32.5 & 27.5 \end{pmatrix} \]

例 2 の表を入れた場合です。行と列の並びは、入力した表とまったく同じなので、位置で読み取れます。)

ヒント打ちこむのではなく、var から選んでください

stat. で始まる名前は打ち間違えやすく、stat.χ² のようにキーボードから打ちにくい文字も混ざっています。

var を押して一覧から選ぶのが、いちばん速くて確実です。

一覧の一番上には、手順2で自分が保存した obs も出てきます。入れた表をもう一度確かめたいときにも使えます。

stat.χ²stat.pval は、結果画面を閉じたあとで値が必要になったときに使えます。もう一度検定をやり直す必要はありません。

警告それでも、式は書いてください

Find the expected frequency と問われたときに、電卓から読んだ数だけを書くのは危険です。過程に点が付くことがあります。

式 1\(1\) 行書いてから、答えを書いてください。

\[\frac{60 \times 130}{240} = 32.5\]

ExpMatrix は、その答えが合っているかを確かめるために使うのが安全です。

\(\chi^2\) goodness of fit

こちらは行列ではなくリストを使います。

1. Lists & Spreadsheet ページで、2つの列を作る

  • 列 A(obs)… 観測度数 \(32, 68, 100\)
  • 列 B(exp)… 期待度数 \(40, 60, 100\)

期待度数は自分で計算して入れます。 電卓は作ってくれません。

2. 検定を実行する

menu → Statistics → Stat Tests → χ² GOF

Observed ListobsExpected Listexp、そして Deg of Freedom に自分で \(\nu\) を入れます。

警告GOF では自由度を自分で入れます

independence と違って、GOF は自由度を聞いてきます。 SL では \(\nu = n - 1\)(カテゴリの数 \(-1\))です。

\(3\) 色なら \(2\)、サイコロなら \(5\)ここを間違えると \(p\)-value が変わります。

2-Sample \(t\) Test

1. Lists & Spreadsheet ページで、2つの列にデータを入れる

列 A に Class A の得点、列 B に Class B の得点。名前をつけておくと選びやすくなります。

2. 検定を実行する

menu → Statistics → Stat Tests → 2-Sample t Test

Data Input MethodData(生データを使う)を選びます。

3. 設定を確認する

表 7: 2-Sample \(t\) Test の設定
入れるもの
List 1 / List 2 2つのデータ列
Freq 1 / Freq 2 1 のまま
Alternative Hyp \(\mu_1 \neq \mu_2\) / \(\mu_1 > \mu_2\) / \(\mu_1 < \mu_2\)
Pooled Yes(必ず)

4. 結果を読む

tPValdf、そして \(\bar{x}_1\)\(\bar{x}_2\)(2つの平均)が表示されます。

ヒント平均を必ず見てください

\(\bar{x}_1\)\(\bar{x}_2\) を見れば、どちらが大きいかがすぐ分かります。

片側検定で \(p\)\(1\) に近い値になったときは、\(H_1\) の向きとリストの順番が食い違っています。 平均を見れば、どちらを List 1 にすべきだったかが分かります。

結果の書き写し方

電卓の画面をそのまま写さないでください。 答案には、必要なものだけを書きます。

表 8: 答案に書くもの
書くもの 書かないもの
\(\chi^2\) または \(t\) の値(3 s.f.) SEsx1n1 など
\(p\)-value(3 s.f.) 画面の全項目
自由度(聞かれたら)

そのうえで、結論の英文が必要です。数値だけでは点になりません。

ノートStat Tests は Press-to-Test でも使えます

試験モード(Press-to-Test)でも、Stat Tests の項目は制限されません。安心して使ってください。

制限されるのは、幾何機能・3Dグラフ・微分方程式などです(付録A参照)。

Exercises

各問題に、折りたたみが3つ付いています。日本語訳解答例(答案用紙に書くべきこと。英語です)、解説(なぜそうなるか。日本語です)。

まず自分で解いて、次に解答例と見くらべてください。解説は、合わなかったときだけ開けば十分です。

1 A school records whether students in three year groups walk or cycle to school.

Walk Cycle
Year 9 25 35
Year 10 40 20
Year 11 30 30

A \(\chi^2\) test for independence is carried out at the \(5\%\) significance level.

(a) Write down the number of degrees of freedom.

(b) Find the \(p\)-value.

(c) State the conclusion in context.

(a) \(\nu = (3-1)(2-1) = 2\)

(b) Using the GDC (\(\chi^2\) 2-way Test): \[\chi^2 = 7.80, \qquad p = 0.0202\]

(c) Since \(p = 0.0202 < 0.05\), we reject \(H_0\). There is sufficient evidence at the \(5\%\) significance level to conclude that the method of travel is not independent of year group.

行が \(3\)、列が \(2\) なので \(\nu = 2 \times 1 = 2\) です。

\(p = 0.0202\)\(0.05\) より小さいので reject。ただし \(1\%\) で検定していたら \(0.0202 > 0.01\) で reject しないことになります。有意水準によって結論が変わる、よい例です。

  1. では method of travelyear group の両方を入れてください。片方だけだと文脈が不十分です。

2 A survey asks people in three cities which of three brands they prefer.

Brand X Brand Y Brand Z
City A 20 30 25
City B 35 25 20
City C 15 25 35

A \(\chi^2\) test for independence is carried out at the \(5\%\) significance level. The critical value is \(9.488\).

(a) Write down the number of degrees of freedom.

(b) Find the \(\chi^2\) statistic.

(c) State, with a reason, the conclusion of the test.

(a) \(\nu = (3-1)(3-1) = 4\)

(b) Using the GDC (\(\chi^2\) 2-way Test): \[\chi^2 = 13.9\]

(c) Since \(\chi^2 = 13.9 > 9.488\), we reject \(H_0\). There is sufficient evidence at the \(5\%\) significance level to conclude that brand preference is not independent of city.

critical value が与えられているので、\(\chi^2\) 統計量と比べます。 \(p\)-value と比べる問題ではありません。

向きに注意。 統計量は大きいと reject です。\(p\) とは逆でした。

\(p\)-value でも同じ結論になります(\(p = 0.00761 < 0.05\))。どちらでも正解ですが、与えられたほうを使うのが自然です。

3 A die is rolled \(120\) times. The results are shown below.

Score 1 2 3 4 5 6
Frequency 18 22 15 25 20 20

A \(\chi^2\) goodness of fit test is carried out at the \(5\%\) significance level to test whether the die is fair.

(a) Write down the expected frequency for each score.

(b) Write down the number of degrees of freedom.

(c) Find the \(p\)-value and state the conclusion.

(a) \[\text{expected} = \frac{120}{6} = 20 \text{ for each score}\]

(b) \(\nu = 6 - 1 = 5\)

(c) Using the GDC (\(\chi^2\) GOF): \[\chi^2 = 2.90, \qquad p = 0.715\]

Since \(p = 0.715 > 0.05\), we do not reject \(H_0\). There is insufficient evidence at the \(5\%\) significance level to conclude that the die is not fair.

「公平」なら \(6\) つの目が等しく出るはずなので、期待度数はどれも \(\dfrac{120}{6} = 20\) です。

\(\nu = 6 - 1 = 5\)電卓に自分で入力するのを忘れないでください。

(c) の結論の書き方に注意。 the die is fair(公平である)と書いてはいけません。書けるのは insufficient evidence to conclude that the die is not fair(公平でないと言うだけの証拠がない)です。

\(p = 0.715\) はかなり大きく、「よく合っている」ことを表しています。

4 A shop expects its customers to choose small, medium and large drinks in the ratio \(5:2.5:2.5\). On one day, \(200\) customers choose \(88\) small, \(52\) medium and \(60\) large.

A \(\chi^2\) goodness of fit test is carried out at the \(5\%\) significance level.

(a) Find the expected frequencies.

(b) Find the \(p\)-value and state the conclusion in context.

(a) Total ratio \(= 5 + 2.5 + 2.5 = 10\)

\[\text{small} = 200 \times \tfrac{5}{10} = 100, \quad \text{medium} = 50, \quad \text{large} = 50\]

(b) Using the GDC (\(\chi^2\) GOF, \(\nu = 2\)): \[\chi^2 = 3.52, \qquad p = 0.172\]

Since \(p = 0.172 > 0.05\), we do not reject \(H_0\). There is insufficient evidence at the \(5\%\) significance level to conclude that the drink sizes are not chosen in the ratio \(5:2.5:2.5\).

比に小数が入っていますが、やることは同じです。合計 \(10\) で割って \(200\) を分けます。

期待度数が整数になるとはかぎりません。 そのまま小数で入れて構いません(今回はたまたま整数です)。

\(\nu = 3 - 1 = 2\) です。カテゴリの数から \(1\) を引きます。

5 A researcher wishes to test whether the colour of a car is independent of the country in which it was bought. She collects data from \(4\) countries and \(3\) colours.

(a) State the null and alternative hypotheses.

(b) Write down the number of degrees of freedom.

(c) The \(p\)-value is found to be \(0.0384\). State the conclusion at the \(5\%\) significance level, and at the \(1\%\) significance level.

(a) \(H_0\): The colour of a car is independent of the country in which it was bought.

\(H_1\): The colour of a car is not independent of the country in which it was bought.

(b) \(\nu = (4-1)(3-1) = 6\)

(c) At the \(5\%\) level: since \(p = 0.0384 < 0.05\), we reject \(H_0\). There is sufficient evidence to conclude that colour is not independent of country.

At the \(1\%\) level: since \(p = 0.0384 > 0.01\), we do not reject \(H_0\). There is insufficient evidence to conclude that colour is not independent of country.

同じ \(p\)-value でも、有意水準が違えば結論が変わります。 これがこの問題の狙いです。

\(0.0384\)\(0.05\)\(0.01\) のあいだにあります。ですから \(5\%\) では reject、\(1\%\) では reject しない。

「有意である」は絶対的な性質ではありません。 どの基準で見るかによって変わります。TOK の議論につながるところです。

  1. \(4\) か国 \(\times\) \(3\) 色なので \((4-1)(3-1) = 6\)。データがなくても自由度は求められます。

6 Two groups of students take the same test. Their scores are shown below.

Group C: \(45, \ 52, \ 48, \ 60, \ 55, \ 47, \ 51, \ 58\)

Group D: \(50, \ 58, \ 62, \ 55, \ 64, \ 59, \ 61, \ 57\)

A \(t\)-test is carried out at the \(5\%\) significance level to test whether there is a difference between the mean scores. It may be assumed that the scores are normally distributed with equal variances.

(a) State the hypotheses.

(b) Find the \(p\)-value.

(c) State the conclusion in context.

(a) \(H_0\): \(\mu_C = \mu_D\)    \(H_1\): \(\mu_C \neq \mu_D\)

(b) Using the GDC (2-Sample \(t\) Test, pooled, two-tailed): \[t = -2.55, \qquad p = 0.0230\]

(c) Since \(p = 0.0230 < 0.05\), we reject \(H_0\). There is sufficient evidence at the \(5\%\) significance level to conclude that there is a difference between the mean scores of the two groups.

whether there is a difference なので 両側です(表 4)。

\(t\)になっていますが、問題ありません。Group C の平均(\(52.0\))が Group D の平均(\(58.25\))より小さいからです。両側検定では符号は結論に影響しません。

\(p\) を答案に書くときは、符号のない \(p = 0.0230\) をそのまま使ってください。

7 A coach claims that a new training programme increases the distance athletes can jump. Seven athletes follow the programme and seven do not. Their jump distances, in metres, are shown below.

With programme: \(13.8, \ 14.2, \ 13.5, \ 14.6, \ 13.9, \ 14.1, \ 13.3\)

Without programme: \(12.5, \ 13.1, \ 11.8, \ 12.9, \ 13.4, \ 12.2, \ 12.7\)

A \(t\)-test is carried out at the \(1\%\) significance level. It may be assumed that the distances are normally distributed with equal variances.

(a) State the hypotheses.

(b) Find the \(p\)-value.

(c) State the conclusion in context.

Let \(\mu_1\) be the mean distance with the programme and \(\mu_2\) without.

(a) \(H_0\): \(\mu_1 = \mu_2\)    \(H_1\): \(\mu_1 > \mu_2\)

(b) Using the GDC (2-Sample \(t\) Test, pooled, one-tailed): \[t = 4.76, \qquad p = 0.000231\]

(c) Since \(p = 0.000231 < 0.01\), we reject \(H_0\). There is sufficient evidence at the \(1\%\) significance level to conclude that athletes who follow the programme jump further on average.

increases(伸びる)と向きが指定されているので 片側です。

プログラムありを List 1 に入れて、\(H_1: \mu_1 > \mu_2\) とそろえてください。逆にすると \(p\)\(1\) に近い値(\(0.99977\))になります。

答案の冒頭に「\(\mu_1\) を〜とする」と書いておくと、採点者に向きが伝わります。片側検定では必ず書いてください。

有意水準が \(5\%\) ではなく \(1\%\) であることも見落とさないように。今回はどちらでも reject ですが、ぎりぎりの問題では結論が変わります。

8 In a \(\chi^2\) test for independence, the \(p\)-value is found to be \(0.062\).

(a) State the conclusion at the \(5\%\) significance level.

(b) State the conclusion at the \(10\%\) significance level.

(c) A student says: “The test at the \(10\%\) level proves that the two variables are related.” Comment on this statement.

(a) Since \(p = 0.062 > 0.05\), we do not reject \(H_0\). There is insufficient evidence at the \(5\%\) significance level to conclude that the variables are not independent.

(b) Since \(p = 0.062 < 0.10\), we reject \(H_0\). There is sufficient evidence at the \(10\%\) significance level to conclude that the variables are not independent.

(c) The statement is not correct. A hypothesis test does not prove anything. It only says that, if \(H_0\) were true, a result like this one would occur less than \(10\%\) of the time. The same data give the opposite conclusion at the \(5\%\) level, so the result depends on the significance level chosen.

(c) がこの問題の本体です。 2つのことを言えば十分です。

  1. 検定は証明ではないA hypothesis test does not prove anything.
  2. 有意水準を変えれば結論が変わるThe same data give the opposite conclusion at the \(5\%\) level.

シラバスの TOK に is saying that a result is significant the same as saying it is true? とあります。答えは No です。

この型は Comment on を求められたときに何度でも使えます。英語のまま覚えてください。

9 For each of the following situations, state which test should be used: a \(\chi^2\) test for independence, a \(\chi^2\) goodness of fit test, or a \(t\)-test. Justify each answer.

(a) Testing whether the mean height of boys differs from the mean height of girls in a school.

(b) Testing whether a spinner with four colours is fair.

(c) Testing whether the type of pet owned is related to the type of housing lived in.

(a) A \(t\)-test, because we are comparing the means of two sets of numerical data.

(b) A \(\chi^2\) goodness of fit test, because we are comparing observed frequencies with the frequencies expected if all four colours were equally likely.

(c) A \(\chi^2\) test for independence, because we are testing whether two categorical variables are related, using a contingency table.

表 3 の使い分けを、そのまま言葉にする問題です。

見分けるポイントは3つです。

  • 平均を比べる → \(t\)-test(データが数値)
  • 決まった割合と比べる → goodness of fit
  • 2つのカテゴリの関係 → independence(表になる)

Justify と書かれているので、答えだけでは点になりません。 「なぜその検定か」を一文で書いてください。

こういう問題は短時間で確実に点が取れます。取りこぼさないように。

10 A researcher carries out a \(t\)-test to compare the mean lifetimes of two brands of battery. She finds \(p = 0.003\) and concludes at the \(5\%\) significance level that Brand A batteries last longer.

(a) State one assumption she must have made for the \(t\)-test to be valid.

(b) She tested \(6\) batteries of each brand. Comment on the reliability of her conclusion.

(a) The lifetimes of the batteries must be normally distributed.

(or: The variances of the two populations must be equal.)

(b) The sample size of \(6\) for each brand is very small, so the sample means may not be typical of the whole population. A larger sample would make the conclusion more reliable. Also, the batteries may not have been chosen at random, which could introduce bias.

(a) はシラバスに書かれている仮定をそのまま書けば正解です。normalequal variances のどちらかで十分です。

(b)Comment on the reliability なので、独立した記述の設問です。次の3つのどれかを書けば点になります。

  1. 標本が小さいThe sample size of 6 is very small.
  2. 大きくすれば信頼できるA larger sample would be more reliable.
  3. 抽出方法The batteries may not have been chosen at random.

\(p = 0.003\) という小さい値が出ていても、標本が \(6\) 個では強い主張はできません。 \(p\) の小ささと標本の大きさは別の話です。

この区別ができると、AI の統計では大きく差がつきます。