Chi-squared tests · 卡方检验
| English | 中文 | Pinyin · 拼音 |
|---|---|---|
| chi-squared/kaɪ skweəd/ | 卡方 | kǎ fāng |
| observed/ɒbˈzɜːvd/ | 观测 | guān cè |
| expected/ekˈspektɪd/ | 期望 | qī wàng |
| critical value/ˈkrɪtɪkl ˈvæljuː/ | 临界值 | lín jiè zhí |
| degrees of freedom/dɪˈɡriːz ɒv ˈfriːdəm/ | 自由度 | zì yóu dù |
| goodness of fit/ˈɡʊdnəs ɒv fɪt/ | 拟合优度 | nǐ hé yōu dù |
| independence/ˌɪndɪˈpendəns/ | 独立性 | dú lì xìng |
| contingency table/kənˈtɪndʒənsi ˈteɪbl/ | 列联表 | liè lián biǎo |
Does the data fit the theory?
- You expect a die to land equally on each face, or eye-colour to be independent of hair-colour. Does the data actually agree?
- The $\chi^2$ (chi-squared 卡方) test measures how far observed 观测 counts stray from what a model predicts — and whether that gap is too big to be chance.
数据符合理论吗?
- 你期望一个骰子均等地落在每个面上,或眼睛颜色与头发颜色无关。数据实际上同意吗?
- $\chi^2$(卡方)检验(chi-squared test)测量观测的计数偏离一个模型预测的有多远——以及那个差距是否大到不可能是偶然。
Chi-squared test route · 卡方检验路径
Follow observed and expected counts to a test decision. · 根据观测频数和期望频数做出检验决策。
The test statistic
- Compare each observed count $O$ with the expected 期望 count $E$ from the model:
- A small $\chi^2$ means the data fits; a large one means it doesn't.
检验统计量
- 把每个观测(observed)计数 $O$ 与模型的期望(expected)计数 $E$ 比较:
- 一个小的 $\chi^2$ 意味着数据符合;一个大的意味着它不符合。
The chi-squared test statistic is: · 卡方检验统计量为:
χ² sums (observed − expected)² ÷ expected over all categories. · χ² 对所有类别求和 (观测值 − 期望值)² ÷ 期望值。
The rejection region
- Compare $\chi^2$ with a critical value 临界值 from the tables for the right degrees of freedom 自由度.
- If $\chi^2$ lands beyond the critical value (in the upper tail), reject the model.
A large χ² lands in the shaded tail — too big to be chance, so the model is rejected.
拒绝域
- 把 $\chi^2$ 与表中对正确自由度的一个临界值(critical value)比较。
- 如果 $\chi^2$ 落在临界值之外(在上尾),拒绝模型。

一个大的 χ² 落在阴影的尾中——大到不可能是偶然,所以模型被拒绝。
A large chi-squared value (beyond the critical value) leads you to reject the model. · 较大的卡方值(超过临界值)会导致你拒绝该模型。
A large χ² means observed and expected differ too much to be chance. · 较大的 χ² 意味着观测值和期望值差异过大,不可能是随机造成的。
Worked example
- Observed counts $20, 30, 25, 25$, each expected to be $25$.
- $\chi^2 = \dfrac{(20-25)^2 + (30-25)^2 + 0 + 0}{25} = \dfrac{25 + 25}{25} = 2$.
- Compared with the critical value, a $\chi^2$ of $2$ is small — the data fits.
例题
- 观测计数 $20, 30, 25, 25$,每个期望是 $25$。
- $\chi^2 = \dfrac{(20-25)^2 + (30-25)^2 + 0 + 0}{25} = \dfrac{25 + 25}{25} = 2$。
- 与临界值相比,一个 $2$ 的 $\chi^2$ 很小——数据符合。
Observed counts 20, 30, 25, 25, each expected 25. What is χ² = Σ(O−E)²/E? · 观测频数为 20, 30, 25, 25,每个期望频数为 25。求 χ² = Σ(O−E)²/E?
((−5)² + 5² + 0 + 0)/25 = 50/25 = 2.
Two uses
- Goodness of fit 拟合优度: does the data follow a proposed distribution (uniform, binomial, Poisson…)?
- Independence 独立性: in a contingency table 列联表, are the two classifications independent? (Expected $= \dfrac{\text{row total} \times \text{column total}}{\text{grand total}}$.)
Pool small expected frequencies. If any expected count is below 5, combine classes first — the $\chi^2$ approximation is unreliable for tiny expected counts.
两个用途
- 拟合优度(goodness of fit):数据是否遵循一个提出的分布(均匀、二项、泊松……)?
- 独立性(independence):在一个列联表(contingency table)中,两个分类是否独立?(期望 $= \dfrac{\text{row total} \times \text{column total}}{\text{grand total}}$。)
合并小的期望频数。 如果任何期望计数低于 5,先合并类——对很小的期望计数,$\chi^2$ 近似不可靠。
Match each chi-squared use to what it tests. · 将每个卡方用途与其检验内容匹配。
Goodness of fit checks a distribution; the independence test uses a contingency table. · 拟合优度检验检查分布;独立性检验使用列联表。
Before testing, pool any class whose expected frequency is below ______. · 在检验之前,将任何期望频数低于 ______ 的类别合并。
The χ² approximation needs expected counts of at least 5; combine smaller ones. · χ² 近似要求期望频数至少为 5;需合并较小的频数。
You've got it
- $\chi^2 = \displaystyle\sum\frac{(O-E)^2}{E}$ — observed vs expected counts
- a large $\chi^2$ (beyond the critical value, upper tail) rejects the model
- uses: goodness of fit and independence; pool expected counts below 5
你掌握了
- $\chi^2 = \displaystyle\sum\frac{(O-E)^2}{E}$——观测对比期望计数
- 一个大的 $\chi^2$(超过临界值,上尾)拒绝模型
- 用途:拟合优度和独立性;合并低于 5 的期望计数