StatsQuest · Maple Diner · Statistics

Counts and Many Means: Chi-Square and ANOVA

Chi-square compares observed counts to expected counts. ANOVA compares three or more means in one test.

PDFBack to the game

After this guide you can

Key terms

Observed count O
What you tallied.
Expected count E
What H₀ predicts: n × p for fit; (row total × column total)/grand total for tables.
χ² statistic
Σ(O − E)²/E; always right tailed.
Goodness of fit
One categorical variable against a claimed distribution; df = k − 1.
Test of independence
Two variables in one sample; df = (r − 1)(c − 1).
ANOVA
Tests H₀: μ₁ = μ₂ = ... = μₖ.
F statistic
MSB/MSW: between-group variation over within-group variation.
Post hoc test
Tukey or Bonferroni comparisons after a significant F.

The big ideas

Chi-square curve with 2 degrees of freedom, critical value 5.991 and the observed 12 in the rejection region0246810121400.10.20.30.40.5critical 5.991χ² = 12χ² curve, df = 2rejection region α = 0.05χ²density

With df = 2 the 5% cutoff is 5.991. An observed χ² of 12 falls far in the tail.

Worth memorizing

dfχ² critical, α = 0.05
13.841
25.991
37.815
49.488

Worked example

The diner expects orders split 25% breakfast, 25% lunch, 50% dinner. Of 200 orders, 50, 30 and 120 came in. Test at α = 0.05.

  1. Expected: 50, 50, 100. All are at least 5.
  2. χ² = (50 − 50)²/50 + (30 − 50)²/50 + (120 − 100)²/100 = 0 + 8 + 4 = 12.
  3. df = 3 − 1 = 2; critical value 5.991.
  4. 12 > 5.991 (p ≈ 0.0025), so reject H₀. Lunch contributes most: fewer lunches than expected.

Answer: The order mix differs from the claim

Common mistakes

Check yourself

  1. df for a 3 × 4 table?
  2. Expected count for a cell with row total 60, column total 50, grand total 200?
  3. O = 30, E = 20. Contribution to χ²?
  4. Is the χ² test left, right or two tailed?
  5. Why not run three t tests to compare three diets?
  6. F = 0.9 with large df. Conclusion?
  7. SST = 500 and SSB = 200. SSW?
  8. After a significant F, what next?

Answer key

  1. 6. (3 − 1)(4 − 1).
  2. 15. 60 × 50/200.
  3. 5. 10²/20.
  4. Right tailed. Only large values are evidence against H₀.
  5. It inflates the Type I error rate. ANOVA keeps it at α.
  6. No evidence the means differ. Between and within variation are similar.
  7. 300. SST = SSB + SSW.
  8. A post hoc test such as Tukey's HSD. To find which pairs differ.

1 Design2 Describing3 Probability4 Normal5 CLT6 Intervals7 Tests8 Regression10 Health stats11 Full review