| Enduring Understanding | Learning Objective | Essential Knowledge |
|---|---|---|
VAR-1 | VAR-1.J |
|
分类数据的推断:卡方
AP 统计学 · 第 8 主题
8.1
统计学导论:我的结果出乎意料吗?
大纲
来源:美国大学理事会 AP 课程与考试说明
当数据是散布在几个类别上的计数(counts)时,我们检验观测计数是否不同于一个宣称预测的。工具是卡方(chi-square)($\chi^2$)统计量,它把观测和期望计数之间的标准化差加起来:
| 英文 | 中文 | 拼音 |
|---|---|---|
| chi-square | 卡方 | kǎ fāng |
| degrees of freedom | 自由度 | zì yóu dù |
8.2
建立卡方拟合优度检验
大纲
| Enduring Understanding | Learning Objective | Essential Knowledge |
|---|---|---|
VAR-8 | VAR-8.A |
|
VAR-8.B |
| |
VAR-8.C |
| |
VAR-8.D |
| |
VAR-8.E |
|
来源:美国大学理事会 AP 课程与考试说明
一个拟合优度(goodness-of-fit,GOF)检验检查一个分类变量是否遵循一个宣称的分布(例如"这个骰子是公平的")。假设:

| 英文 | 中文 | 拼音 |
|---|---|---|
| goodness-of-fit (GOF) | 拟合优度 | nǐ hé yōu dù |
8.3
执行卡方拟合优度检验
大纲
| Enduring Understanding | Learning Objective | Essential Knowledge |
|---|---|---|
VAR-8 | VAR-8.F |
|
VAR-8.G |
| |
DAT-3 | DAT-3.I |
|
DAT-3.J |
|
来源:美国大学理事会 AP 课程与考试说明
计算 $\chi^2=\sum\dfrac{(O-E)^2}{E}$ 带 $df=(\text{number of categories})-1$。从卡方分布(上尾)求 $p$ 值、与 $\alpha$ 比较,并在上下文里得出结论。这个和的一个大分量指向偏离最多的类别。

Worked example. 一个骰子掷 $60$ 次给出计数 $8,10,12,9,11,10$。若它公平,每个期望计数是 $60/6=10$,所以
Explore the chi-square distribution and its p-value
The p-value is the area in the right tail beyond your test statistic, so a larger $\chi^2$ means a smaller p-value. Drag $\chi^2$ to watch that area shrink, and drag df to see the whole family change shape — strongly right-skewed at small df, more symmetric as df grows.
8.4
双向表中的期望频数
大纲
| Enduring Understanding | Learning Objective | Essential Knowledge |
|---|---|---|
VAR-8 | VAR-8.H |
|
来源:美国大学理事会 AP 课程与考试说明
对于一个双向表,一个单元格里的期望计数(在"没有关联"下)是
Worked example. 在一个双向表里一个单元格的行总计是 $40$、它的列总计是 $50$,而总计是 $200$。它的期望计数是 $E=\dfrac{40\times50}{200}=10$。对每个单元格重复给出期望表以对照观测的那个比较。

8.5
建立卡方齐性或独立性检验
大纲
| Enduring Understanding | Learning Objective | Essential Knowledge |
|---|---|---|
VAR-8 | VAR-8.I |
|
VAR-8.J |
| |
VAR-8.K |
|
来源:美国大学理事会 AP 课程与考试说明
两个检验用相同的 $\chi^2$ 数学但回答不同的问题:
- 同质性检验(test for homogeneity):一个分类变量的分布是否跨几个总体或组相同(分开的样本/处理)?
- 独立性检验(test for independence):两个分类变量是否在单个总体内关联(一个样本、测量两个变量)?
设计(几个样本对一个样本)决定用哪个名称和假设。
| 英文 | 中文 | 拼音 |
|---|---|---|
| Test for homogeneity | 同质性 | tóng zhì xìng |
| Test for independence | 独立性 | dú lì xìng |
8.6
执行卡方齐性或独立性检验
大纲
| Enduring Understanding | Learning Objective | Essential Knowledge |
|---|---|---|
VAR-8 | VAR-8.L |
|
VAR-8.M |
| |
DAT-3 | DAT-3.K |
|
DAT-3.L |
|
来源:美国大学理事会 AP 课程与考试说明
计算期望计数,然后在所有单元格上 $\chi^2=\sum\dfrac{(O-E)^2}{E}$,带
8.7
技能聚焦:为分类数据选择合适的推断方法
大纲
This topic is intended to focus on the skill of selecting an appropriate inference procedure now that students have a range of options. Students should be given opportunities to practice when and how to apply all learning objectives relating to inference for categorical data.
来源:美国大学理事会 AP 课程与考试说明
按设置决定:一个分类变量对照一个宣称的分布 $\Rightarrow$ 拟合优度;一个样本按两个变量交叉分类 $\Rightarrow$ 独立性;比较几个样本/组 $\Rightarrow$ 同质性。只比较两个比例能用一个两比例 $z$ 检验或一个卡方检验,但仅限双尾备择假设,此时两者完全一致($\chi^2=z^2$)。卡方检验总是双尾的,所以它给不出有方向的结论:若 $H_a$ 是单尾的(比如 $p_1>p_2$),要用 $z$ 检验。
Which chi-square test is this?
All three tests use the same $\chi^2$ arithmetic, so the marks are won by naming the right one. The design decides — how many samples were taken, and how many variables were measured on each unit.
8.7
考试技巧
- 对分类数据用 $\chi^2=\sum\tfrac{(O-E)^2}{E}$;总是除以期望计数。
- 挑正确的检验:拟合优度(一个变量)、独立性,或同质性(双向表)。
- 把期望计数算作 $\tfrac{\text{row total}\times\text{column total}}{\text{grand total}}$ 并检查每个 $\ge5$。
- 一个大的 $\chi^2$(小 p 值)意味着观测计数比机会更多地不同于期望。
- 正确地陈述自由度(类别 $-1$,或 $(r-1)(c-1)$)。
本主题的互动课程
逐步学习,并即时检测练习。