Chi-squared tests
| English | Chinese | Pinyin |
|---|---|---|
| chi-squared | 卡方 | kǎ fāng |
| observed | 观测 | guān cè |
| expected | 期望 | qī wàng |
| critical value | 临界值 | lín jiè zhí |
| degrees of freedom | 自由度 | zì yóu dù |
| goodness of fit | 拟合优度 | nǐ hé yōu dù |
| independence | 独立性 | dú lì xìng |
| contingency table | 列联表 | 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-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.
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.
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.
Observed counts 20, 30, 25, 25, each expected 25. What is χ² = Σ(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.
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.
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