Unit 8: Inference for Categorical Data: Chi-Square
Chi-Square Goodness of Fit
Testing whether a categorical variable follows a hypothesized distribution.
Testing Whether a Categorical Variable Matches a Claimed Distribution
A die is rolled 120 times: face 1 comes up 15 times, face 2 comes up 14, face 3 comes up 25, face 4 comes up 28, face 5 comes up 16, face 6 comes up 22. Before reading on: if the die really were fair, about how many times would you expect each face to appear in 120 rolls — and how far do the actual counts drift from that?
Definition — Chi-Square Goodness-of-Fit Test
Worked Example — Conducting a Goodness-of-Fit Test
Since χ² = 8.5 < 11.070, fail to reject H₀: there is not convincing evidence that this die is unfair. The observed counts do drift from 20 in each direction, but not by more than ordinary chance variation would produce if the die really were fair.
Tip
Common Mistakes
Computing expected counts as equal shares of the observed total without reference to the actual hypothesized proportions in H₀.
Expected counts come from H₀'s claimed proportions (here, 1/6 per face) applied to the sample size — for a goodness-of-fit test with unequal hypothesized proportions, the expected counts would differ across categories accordingly.
Key Takeaways
- A goodness-of-fit test compares one categorical variable's observed distribution to a specific hypothesized distribution.
- χ² = Σ(O−E)²/E, with df = categories − 1, and every expected count must be at least 5.
- A large χ² relative to its critical value signals the observed counts drift more than chance alone would explain.
Summary
The next lesson extends the same chi-square logic to test for an association between two categorical variables — directly revisiting the two-way table from Unit 2.
Sign in to track your progress and mark this lesson complete.
Track your progress