Chi-squared tests
Introduced| English | Meaning |
|---|---|
| chi-squared/kaɪ skweəd/ | chi-squared |
| observed/ɒbˈzɜːvd/ | observed |
| expected/ekˈspektɪd/ | expected |
| critical value/ˈkrɪtɪkl ˈvæljuː/ | A boundary value separating a hypothesis test's rejection region from its non-rejection region. |
| degrees of freedom/dɪˈɡriːz ɒv ˈfriːdəm/ | The number of independent values free to vary after relevant constraints have been imposed. |
| goodness of fit/ˈɡʊdnəs ɒv fɪt/ | How closely a statistical model's predicted values or frequencies agree with observed data. |
| independence/ˌɪndɪˈpendəns/ | The condition in which learning about one event or variable does not change the probabilities associated with another. |
| contingency table/kənˈtɪndʒənsi ˈteɪbl/ | A table showing frequencies for combinations of categories of two variables. |
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:
Difficulty 1/5 · 100 coins + a small bonus on first completion today
χ² 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.
Difficulty 1/5 · 100 coins + a small bonus on first completion today
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?
Difficulty 2/5 · 140 coins + a small bonus on first completion today
((−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.
Difficulty 2/5 · 140 coins + a small bonus on first completion today
Goodness of fit checks a distribution; the independence test uses a contingency table.
Before testing, pool any class whose expected frequency is below ______.
Difficulty 1/5 · 100 coins + a small bonus on first completion today
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