統計で英語多読 6-4: 適合度の検定 — データは理論通りの分布か?(カイ二乗検定)
適合度の検定を題材にした英語多読ユニット。約620語の英文と全文日本語訳で、観測度数と期待度数のずれをカイ二乗検定で確かめる方法を読みます。
「大人のための英語多読図書館」へようこそ。今回は、観測されたデータが理論通りの分布に従うかを確かめる適合度のカイ二乗検定を、英語の文章でたどっていきます。
📊 このユニットの情報 語数: 約620語 / 推定読了時間: 5〜7分 / 難易度: ★★☆☆☆(初中級)
Learning Objectives
みなさんこんにちは。大人のための英語多読図書館へようこそ。
サイコロを振ったとき、1から6の目は本当に同じ確率で出るのでしょうか?あるウェブサイトで、曜日ごとのアクセス数に違いはあるのでしょうか?このように、「実際に観測されたデータ」が、「理論的に期待される分布」と一致している(適合している)と言えるのかを検証したい時があります。
今回は、このような「適合度」をチェックするためのカイ二乗検定を学びます。前回学んだカイ二乗分布を再び使いますが、目的は分散の検定とは全く異なります。ここでは「観測度数」と「期待度数」という2つの数値を比べ、その差が偶然によるものなのか、それとも意味のある違いなのかを判断する方法を解説します。この手法は、アンケート結果の分析や遺伝学など、幅広い分野で使われる便利なツールです。
それでは今回も多読を楽しんでいきましょう。
Summary
- The Chi-Square Goodness-of-Fit Test is used to determine if an observed frequency distribution fits a theoretical or expected frequency distribution.
- This test is used for categorical data where we have counts of observations in different categories.
- The core idea is to compare the Observed Frequencies (O)—the actual counts in our sample—with the Expected Frequencies (E)—the counts we would expect if the null hypothesis were true.
- The null hypothesis (\(H_0\)) states that the observed data follows the specified distribution. The alternative hypothesis (\(H_1\)) states that it does not.
- The chi-square test statistic measures the discrepancy between the observed and expected frequencies. It is calculated as: \[ \chi^2 = \sum \frac{(O - E)^2}{E} \]
- The degrees of freedom (df) for this test are calculated as k - 1, where k is the number of categories.
Explanation
Does Reality Match Theory?
Imagine you are a manager of a retail store. You believe that customer traffic is the same every day of the week. To test this, you count the number of customers for one week. The data you collect is your Observed Frequency (O).
- Monday: 110
- Tuesday: 95
- Wednesday: 90
- Thursday: 100
- Friday: 130
- Saturday: 135
- Sunday: 140
- Total Customers: 800
Now, what is the Expected Frequency (E)? Your theory (the null hypothesis) is that traffic is evenly distributed. So, you would expect the total number of customers (800) to be split equally among the 7 days. - Expected customers per day = 800 / 7 \(\approx\) 114.3
The Goodness-of-Fit test helps us decide if the differences between the observed numbers (110, 95, etc.) and the expected number (114.3) are small enough to be due to random chance, or large enough to suggest that customer traffic is not the same every day.
The Steps of a Chi-Square Goodness-of-Fit Test
Let's formally test the store manager's hypothesis using a significance level of \(\alpha = 0.05\).
-
State Hypotheses:
- Null Hypothesis (\(H_0\)): The distribution of customers is uniform across all days of the week. (i.e., \(P_{Mon} = P_{Tue} = ... = P_{Sun} = 1/7\))
- Alternative Hypothesis (\(H_1\)): The distribution of customers is not uniform.
-
Calculate Expected Frequencies (E): As we calculated, the expected frequency for each of the 7 days is 800 / 7 \(\approx\) 114.3.
-
Calculate the \(\chi^2\)-statistic: The formula is \(\chi^2 = \sum \frac{(O - E)^2}{E}\). We calculate this for each category (day) and sum them up.
| Day | Observed (O) | Expected (E) | O - E | (O - E)\(^2\) | (O - E)\(^2\) / E |
|---|---|---|---|---|---|
| Monday | 110 | 114.3 | -4.3 | 18.49 | 0.162 |
| Tuesday | 95 | 114.3 | -19.3 | 372.49 | 3.259 |
| Wednesday | 90 | 114.3 | -24.3 | 590.49 | 5.166 |
| Thursday | 100 | 114.3 | -14.3 | 204.49 | 1.789 |
| Friday | 130 | 114.3 | 15.7 | 246.49 | 2.156 |
| Saturday | 135 | 114.3 | 20.7 | 428.49 | 3.749 |
| Sunday | 140 | 114.3 | 25.7 | 660.49 | 5.778 |
| Total | 800 | 800 | \(\chi^2 = 22.059\) |
Our calculated test statistic is \(\chi^2 = 22.059\).
-
Make a Decision: We need to find the critical value from the \(\chi^2\) distribution. The degrees of freedom (df) for a goodness-of-fit test is k - 1, where k is the number of categories. Here, we have 7 days, so \(df = 7 - 1 = 6\). With \(\alpha = 0.05\) and \(df = 6\), the critical value from the table is 12.592. Our test statistic (22.059) is much larger than the critical value (12.592). Therefore, it falls in the rejection region. We reject the null hypothesis.
-
Conclusion: There is strong statistical evidence to conclude that customer traffic is not evenly distributed throughout the week. The manager can see that the weekend days (especially Sunday) are significantly busier than the weekdays (especially Wednesday).
Another Example: Testing a Die
The Goodness-of-Fit test is not limited to uniform distributions. Suppose a company makes dice and claims they are fair. We roll a die 60 times and get the following results:
- 1: 10 times
- 2: 7 times
- 3: 5 times
- 4: 15 times
- 5: 11 times
- 6: 12 times
Is the die fair? - \(H_0\): The die is fair (\(P(1)=P(2)=...=P(6)=1/6\)). - \(H_1\): The die is not fair. - Expected frequency for each face: 60 rolls * (1/6) = 10 times.
You would then calculate the \(\chi^2\) statistic: \[ \chi^2 = \frac{(10-10)^2}{10} + \frac{(7-10)^2}{10} + \frac{(5-10)^2}{10} + \frac{(15-10)^2}{10} + \frac{(11-10)^2}{10} + \frac{(12-10)^2}{10} \] \[ \chi^2 = 0 + 0.9 + 2.5 + 2.5 + 0.1 + 0.4 = 6.4 \]
The degrees of freedom would be \(k-1 = 6-1=5\). The critical value for \(\alpha = 0.05\) and \(df=5\) is 11.070. Since our statistic (6.4) is less than the critical value, we would fail to reject the null hypothesis and conclude there isn't enough evidence to say the die is unfair.
まとめ
今回は、実際に観測されたデータが、理論的に期待される分布にどれだけ「適合」しているかを確かめるカイ二乗適合度検定を見てきました。観測度数(O)と期待度数(E)の差を\(\chi^2 = \sum (O-E)^2/E\)という統計量にまとめ、それを自由度\(k-1\)の臨界値と比べて判断します。来店客数が曜日ごとに均等かという例ではばらつきが大きく帰無仮説を棄却し、サイコロが公平かという例では証拠が足りず棄却できないという、対照的な結論をたどりました。
これで統計入門シリーズの全28ユニットは完結です。記述統計から確率、推定・検定まで、英語で一通りたどってきました。最後まで読み進めてくださって、お疲れさまでした。
日本語訳(全文)
英文を最後まで読み終えてから、答え合わせ用にお使いください。多読の原則として、まずは訳を見ずに英文だけで理解を試みることをおすすめします。
Summary
- カイ二乗適合度検定は、観測された度数分布が、理論的あるいは期待される度数分布に適合しているかどうかを判断するために使われます。
- この検定は、異なるカテゴリーごとの観測数を持つカテゴリーデータ(質的データ)に対して使われます。
- 核心となる考え方は、観測度数(O)、すなわち標本における実際の数を、期待度数(E)、すなわち帰無仮説が正しいとした場合に期待される数と比較することです。
- 帰無仮説(\(H_0\))は、観測されたデータが指定された分布に従う、と述べます。対立仮説(\(H_1\))は、従わない、と述べます。
- カイ二乗検定統計量は、観測度数と期待度数の食い違いを測ります。次のように計算されます。 \[ \chi^2 = \sum \frac{(O - E)^2}{E} \]
- この検定の自由度(df)は、k - 1として計算されます。ここでkはカテゴリーの数です。
現実は理論と一致するか?
あなたが小売店の店長だと想像してください。あなたは、来店客数は週のどの曜日も同じだと考えています。これを検証するために、1週間の客数を数えます。あなたが集めるデータが、観測度数(O)です。
- 月曜: 110
- 火曜: 95
- 水曜: 90
- 木曜: 100
- 金曜: 130
- 土曜: 135
- 日曜: 140
- 合計客数: 800
では、期待度数(E)は何でしょうか。あなたの理論(帰無仮説)は、客足が均等に分布している、というものです。ですから、客数の合計(800)が7日間に等しく分かれると期待することになります。 - 1日あたりの期待客数 = 800 / 7 \(\approx\) 114.3
適合度検定は、観測された数(110、95など)と期待される数(114.3)との差が、偶然によるものといえるほど小さいのか、それとも来店客数は毎日同じでは「ない」と示唆するほど大きいのかを判断する助けになります。
カイ二乗適合度検定の手順
有意水準\(\alpha = 0.05\)を使って、店長の仮説を正式に検定してみましょう。
-
仮説を立てる:
- 帰無仮説(\(H_0\)): 客数の分布は、週のすべての曜日で一様である。(すなわち、\(P_{Mon} = P_{Tue} = ... = P_{Sun} = 1/7\))
- 対立仮説(\(H_1\)): 客数の分布は一様ではない。
-
期待度数(E)を計算する: 計算したとおり、7日それぞれの期待度数は800 / 7 \(\approx\) 114.3です。
-
\(\chi^2\)統計量を計算する: 式は\(\chi^2 = \sum \frac{(O - E)^2}{E}\)です。これを各カテゴリー(曜日)ごとに計算し、合計します。
| 曜日 | 観測度数 (O) | 期待度数 (E) | O - E | (O - E)\(^2\) | (O - E)\(^2\) / E |
|---|---|---|---|---|---|
| 月曜 | 110 | 114.3 | -4.3 | 18.49 | 0.162 |
| 火曜 | 95 | 114.3 | -19.3 | 372.49 | 3.259 |
| 水曜 | 90 | 114.3 | -24.3 | 590.49 | 5.166 |
| 木曜 | 100 | 114.3 | -14.3 | 204.49 | 1.789 |
| 金曜 | 130 | 114.3 | 15.7 | 246.49 | 2.156 |
| 土曜 | 135 | 114.3 | 20.7 | 428.49 | 3.749 |
| 日曜 | 140 | 114.3 | 25.7 | 660.49 | 5.778 |
| 合計 | 800 | 800 | \(\chi^2 = 22.059\) |
計算された検定統計量は\(\chi^2 = 22.059\)です。
-
判断を下す: \(\chi^2\)分布から臨界値を求める必要があります。適合度検定の自由度(df)は、k - 1です。ここでkはカテゴリーの数です。今回は7曜日あるので、\(df = 7 - 1 = 6\)です。 \(\alpha = 0.05\)、\(df = 6\)では、表からの臨界値は12.592です。 検定統計量(22.059)は、臨界値(12.592)よりはるかに大きいです。したがって、棄却域に入ります。私たちは帰無仮説を棄却します。
-
結論: 来店客数は週を通じて均等には分布していない、と結論づける強い統計的証拠があります。店長は、週末(特に日曜)が平日(特に水曜)よりも明らかに忙しいことを見てとれます。
もう一つの例: サイコロの検定
適合度検定は、一様分布に限られるものではありません。ある会社がサイコロを作り、それが公平だと主張しているとしましょう。サイコロを60回振って、次の結果を得ました。
- 1: 10回
- 2: 7回
- 3: 5回
- 4: 15回
- 5: 11回
- 6: 12回
このサイコロは公平でしょうか。 - \(H_0\): サイコロは公平である(\(P(1)=P(2)=...=P(6)=1/6\))。 - \(H_1\): サイコロは公平ではない。 - 各目の期待度数: 60回 * (1/6) = 10回。
そして、\(\chi^2\)統計量を計算します。 \[ \chi^2 = \frac{(10-10)^2}{10} + \frac{(7-10)^2}{10} + \frac{(5-10)^2}{10} + \frac{(15-10)^2}{10} + \frac{(11-10)^2}{10} + \frac{(12-10)^2}{10} \] \[ \chi^2 = 0 + 0.9 + 2.5 + 2.5 + 0.1 + 0.4 = 6.4 \]
自由度は\(k-1 = 6-1=5\)となります。\(\alpha = 0.05\)、\(df=5\)の臨界値は11.070です。統計量(6.4)は臨界値より小さいので、私たちは帰無仮説を棄却できず、このサイコロが不公平だと言うには証拠が足りない、と結論づけることになります。