Lesson 20 of 23 · All lessons in this module
  1. The central limit theorem
  2. The standard error of the sample meanVideo lesson
  3. Confidence intervals for the mean
  4. Value at risk: a one-sided confidence interval
  5. Populations, samples and sampling error
  6. Stratified and cluster sampling
  7. Good estimators, and the CLT across sampling designs
  8. Convenience and judgmental sampling, and choosing a method
  9. The four steps and stating the hypotheses
  10. Type I and Type II errors, significance and powerVideo lesson
  11. Critical values, p-values and the decision ruleVideo lesson
  12. p-values and p-hacking
  13. Testing a single mean
  14. Two means: independent vs paired samplesVideo lesson
  15. Testing variances: chi-square and FVideo lesson
  16. The t-test for a Pearson correlation
  17. Sample size, p-values and many correlations at once
  18. Parametric vs nonparametric tests
  19. The Spearman rank correlation testVideo lesson
  20. Contingency tables and the chi-square test of independenceVideo lesson
  21. Interpreting the result: standardized residuals and mosaics
  22. Choosing the test: four steps and a map of every test
  23. Integrated cases: testing whether a new strategy beats the old one

This lesson is part of the 2027 curriculum. You are following the 2026 curriculum, where it is not taught in this form. Switch if you are sitting the exam under the 2027 curriculum.

Lesson 20 of 23 · 14 min

Contingency tables and the chi-square test of independence

For categorical data, compare the count in each cell with the count you would expect if the two classifications had nothing to do with each other.

In short

  • A contingency table (two-way table) counts observations classified by two categorical variables.
  • H0 H_0 : the classifications are independent (not related); Ha H_a : they are not independent (related).
  • Expected frequency: Eij E_{ij} = (row i total × column j total) / overall total.
  • χ2=∑(Oij−Eij)2/Eij \chi^2 = \sum (O_{ij}-E_{ij})^2/E_{ij} over all m = r × c cells, with (r − 1)(c − 1) degrees of freedom.
  • The test is non-parametric and right-tailed: squared gaps make χ2≥0 \chi^2 \ge 0 , so only large values reject.

Unlock this lesson free for 7 days

Create a free account to get 7 days free: every lesson, video and flashcard, and the question bank. No card needed.