Chi-squared tests
Chi-squared tests
- A $\chi^2$-test compares observed counts $O$ with expected counts $E$:
$$\chi^2 = \sum \frac{(O - E)^2}{E}$$
- Compare with a table value for the right degrees of freedom.
- Two uses: a goodness-of-fit test (does the data follow the model?) and a test of independence in a contingency table.
Practice
Observed counts 20, 30, 25, 25, each expected 25. What is χ² = Σ(O−E)²/E?
χ² = [(20−25)² + (30−25)² + 0 + 0]/25 = (25 + 25)/25 = 50/25 = 2.
Practice
A chi-squared goodness-of-fit test checks whether:
Goodness of fit tests whether observed data matches the expected distribution; another use is testing independence.
Practice
A chi-squared value larger than the critical value leads you to reject the model.
A large χ² means observed and expected differ too much, so the model is rejected.
You've got it
Key idea
- $\chi^2 = \displaystyle\sum\frac{(O-E)^2}{E}$, comparing observed vs expected counts
- a large $\chi^2$ (beyond the critical value) rejects the model
- uses: goodness of fit and independence (contingency tables)