Setting Up a Goodness-of-Fit Test (Extension)
引入
7:48
分类数据的推断:卡方
掷一枚公平骰子六十次。每个面应出现十次。但从未如此——这里八次,那里十三次。差距始终存在。因此再掷一次…
英文讲解 · 可切换中英文字幕
本课内容
| English | 释义 | 拼音 |
|---|---|---|
| goodness-of-fit/ˈɡʊdnəs ɒv fɪt/ | 拟合优度 | nǐ hé yōu dù |
| hypotheses | 假设 | jiǎ shè |
| variable/ˈveərɪəbl/ | 变量 | biàn liàng |
| distribution/ˌdɪstrɪˈbjuːʃn/ | 分布 | fēn bù |
| proportions | 比例 | bǐ lì |
| expected count/ekˈspektɪd kaʊnt/ | 期望频数 | qī wàng pín shù |
| category/ˈkætɪɡəri/ | 类别 | lèi bié |
| null model | 原假设模型 | yuán jiǎ shè mó xíng |
| chi-square statistic/kaɪ skweə stəˈtɪstɪk/ | 卡方统计量 | kǎ fāng tǒng jì liàng |
| observed counts/ɒbˈzɜːvd kaʊnts/ | 观察频数 | guān chá pín shuò |
| Random/ˈrændəm/ | 随机性条件 | suí jī xìng tiáo jiàn |
| random sample/ˈrændəm ˈsæmpl/ | 随机样本 | suí jī yàng běn |
| randomized process | 随机化过程 | suí jī huà guò chéng |
| sampling without replacement | 不放回抽样 | bù fàng huí chōu yàng |
| chi-square approximation | 卡方近似 | kǎ fāng jìn sì |
| simulation method | 模拟方法 | mó nǐ fāng fǎ |
| Degrees of freedom/dɪˈɡriːz ɒv ˈfriːdəm/ | 自由度 | zì yóu dù |
| probabilities | 概率 | gài lǜ |
| parameters/pəˈræmɪtəz/ | 参数 | cān shù |
| chi-square curve | 卡方分布曲线 | kǎ fāng fēn bù qū xiàn |
| p-value/piː ˈvæljuː/ | P值 | P zhí |
| sample size/ˈsæmpl saɪz/ | 样本量 | yàng běn liàng |
| independent observations | 独立观测值 | dú lì guān cè zhí |
拟合优度假设
- 拟合优度检验用一个变量对照宣称的分布;本课内容超出了修订后的 AP 考试范围。
- **零假设 $H_0$:**宣称的分布是正确的(例如所有比例都如所述)。
- 备择假设 $H_a$:分布不如所称(至少一个比例不同)。
- $H_a$ 是一个表示“有些地方不对劲”的陈述,并不指明方向。
期望计数
- 一个类别的期望计数 = $n \times$(该类别宣称的比例)。
- 对于 $100$ 颗糖果,每种颜色各占 $25\%$:每种颜色的期望计数为 $= 100 \times 0.25 = 25$。
- 期望计数不必是整数——要保留精确值。
- 它们是原假设模型预测的平均计数。
检查条件
- **随机:**数据来自随机样本或随机化过程。
- **10%:**不放回抽样时,$n \le 0.10N$。
- 大计数:****每个期望计数 $\ge 5$(这是卡方检验的条件)。
- 如果任何期望计数低于 $5$,就不能依据这条准则使用卡方近似;可以考虑合适的精确方法或模拟方法。

自由度
- 如果所有类别的概率都已事先指定,$df = (\text{number of categories}) - 1$;用这些数据拟合参数可能会使 $df$ 减少。
- 四种糖果颜色 → $df = 4 - 1 = 3$。
- $df$ 决定用哪条卡方分布曲线求 p 值。
- 它取决于类别数,而非样本量。
The die test's reference curve, df = 5
$df=k-1$
Six faces give df = 5. Move the statistic and read the right-tail area; at 11.07 it is 0.05. A larger statistic means observed counts sit further from expected.
卡方检验的大计数条件是“每个期望计数 $\ge 5$”,而不是观测计数。要检查期望计数,并且全部检查——只要有一个期望计数过小,就不符合这条近似准则。而且这里 $df = \text{categories} - 1$(常见的失误是用 $n-1$,那是用于 $t$ 的,而不是用于卡方拟合优度检验)。

用 $60$ 次投掷检验一个骰子是否均匀。$H_0$:每面的概率为 $1/6$。
- 每面的期望计数:$60 \times \tfrac{1}{6} = 10$(都 $\ge 5$ ✓)。
- $df$:$6 - 1 = 5$(六个面)。
- **$H_a$:**骰子不均匀——至少一面的概率不同。

拟合优度检验的零假设 $H_0$:宣称的分布成立;备择假设 $H_a$:宣称的分布不成立。期望计数 $= n \times$(宣称的比例);检查随机性、10% 条件以及每个期望计数 $\ge 5$。自由度为 $(\text{categories}) - 1$。
根据数据写出:求期望计数
- 一个拟合优度模型包含四个等可能的类别。
- 共有 80 个独立观测值;原假设中每个类别的概率均为 1/4。
A null goodness-of-fit model specifies four equally likely categories for 80 independent observations. Find each expected count and check the expected-count condition.
Equal categories share the sample size.
A null goodness-of-fit model specifies four equally likely categories for 80 independent observations. Find each expected count and check the expected-count condition.
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
80 divided by 4 is 20. Other options — 10 (the other sample); 5 (the minimum condition).
The claimed distribution
Expected counts come from the null distribution's proportions.
A fair die is rolled 60 times. What is the expected count for each face (60 × 1/6)?
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
60 × 1/6 = 10.
For a goodness-of-fit test with 6 categories, what are the degrees of freedom?
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
df = categories − 1 = 6 − 1 = 5.
The large counts condition for a chi-square test requires...
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
All EXPECTED counts must be at least 5.
Expected counts must always be whole numbers.
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
Keep them exact — they need not be integers.
The alternative hypothesis for a goodness-of-fit test says...
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
Ha is a non-directional 'the distribution isn't as claimed'.
出了什么问题?只有网站团队能看到这些信息。