Chi-squared tests
Introducido| English | Significado |
|---|---|
| chi-squared/kaɪ skweəd/ | chi-cuadrado |
| observed/ɒbˈzɜːvd/ | observado |
| expected/ekˈspektɪd/ | esperado |
| critical value/ˈkrɪtɪkl ˈvæljuː/ | valor crítico |
| degrees of freedom/dɪˈɡriːz ɒv ˈfriːdəm/ | grados de libertad |
| goodness of fit/ˈɡʊdnəs ɒv fɪt/ | ajuste de bondad |
| independence/ˌɪndɪˈpendəns/ | independencia |
| contingency table/kənˈtɪndʒənsi ˈteɪbl/ | tabla de contingencia |
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.
Ruta de la prueba de chi-cuadrado
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:
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
χ² sums (observed − expected)² ÷ expected over all categories.
Hypotheses, degrees of freedom and the critical value
- $H_0$: the model fits (or: the two factors are independent). $H_1$: it does not fit (or: they are associated).
- Degrees of freedom 自由度 $\nu$: for goodness of fit, $\nu$ is the number of classes (after pooling), minus 1, minus the number of parameters estimated from the data. For an $r\times c$ contingency table, $\nu=(r-1)(c-1)$.
- Reject $H_0$ if $\chi^2$ is greater than the critical value 临界值. At the 5% level: $\nu=1$: 3.841, $\nu=2$: 5.991, $\nu=3$: 7.815.

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.
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
A large χ² means observed and expected differ too much to be chance.
A 3 × 4 contingency table is tested for independence. How many degrees of freedom?
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
ν = (3 − 1)(4 − 1) = 6.
A Poisson model is fitted to 6 classes (after pooling), with λ estimated from the data. What is ν?
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
ν = 6 − 1 − 1 = 4: one for the total, one for the estimated λ.
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$.
- Four classes and no estimated parameters, so $\nu=3$ and the critical value is 7.815. Since $2<7.815$, do not reject $H_0$: there is no evidence that the model is wrong.
Observed counts 20, 30, 25, 25, each expected 25. What is χ² = Σ(O−E)²/E?
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
((−5)² + 5² + 0 + 0)/25 = 50/25 = 2.
Observed counts are 10, 20 and 30, and each expected count is 20. What is chi-square, and why are expected counts below 5 pooled?
Chi-square adds squared differences divided by the expected counts. The approximation needs those expected counts not to be tiny.
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.
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
Goodness of fit checks a distribution; the independence test uses a contingency table.
Before testing, pool any class whose expected frequency is below ______.
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
The χ² approximation needs expected counts of at least 5; combine smaller ones.
In a contingency table with grand total 200, a row total is 80 and a column total is 45. Find the expected frequency for that cell.
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
80 × 45 ÷ 200 = 18.
Worked exam question: a contingency table
Question (7 marks). 100 students were asked how they travel to school.
| Bus | Walk | Car | Total | |
|---|---|---|---|---|
| Year 12 | 36 | 14 | 10 | 60 |
| Year 13 | 14 | 16 | 10 | 40 |
| Total | 50 | 30 | 20 | 100 |
Test, at the 5% level, whether travel method is independent of year group.
- $H_0$: travel method and year group are independent. $H_1$: they are not independent (B1).
- Expected $=\dfrac{\text{row total}\times\text{column total}}{100}$ (M1): Year 12: 30, 18, 12; Year 13: 20, 12, 8. All are at least 5, so no pooling is needed.
- Contributions $\dfrac{(O-E)^2}{E}$ (M1): 1.200, 0.889, 0.333, 1.800, 1.333, 0.500. So $\chi^2=6.06$ (A1).
- $\nu=(2-1)(3-1)=2$, critical value 5.991 (B1).
- $6.06>5.991$, so reject $H_0$ (M1). There is evidence at the 5% level that travel method depends on year group (A1).
Why answers lose marks: using $\nu=6-1=5$ for a table; writing "$H_0$ is true" or "proved"; or giving a conclusion with no context.
Without looking back: a test of independence on a 2 × 2 table gives χ² = 2.9. State the hypotheses, ν, the 5% critical value and the conclusion.
Never say H₀ is proved true.
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
- $\nu$ = classes − 1 − estimated parameters; contingency table $(r-1)(c-1)$
- uses: goodness of fit and independence; pool expected counts below 5; conclude in context
What is chi-square?
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
Each outer cell contributes 5, and 5 plus 5 is 10.