Skip to content
  • Open the math solver
  • Ask the AI tutor
  • Find an AP course
  • Create a quiz
  • Open the calculator
  • Graphing Calculator
  • Browse all calculators
  • Read math guides
↑ ↓Enter to open · Esc to close
Solve a problem
UnofficialAP StatisticsUnit 8 of 9

AP Statistics Unit 8: Inference for Categorical Data: Chi-Square

Goodness-of-fit, homogeneity and independence tests.

Unit overview

Chi-square procedures handle categorical variables with more than two categories. A goodness-of-fit test compares one variable's observed counts with a claimed distribution. Tests for homogeneity and independence use a two-way table: homogeneity compares several populations, while independence looks at two variables in one population.

The statistic is χ2=∑(O−E)2E\chi^2 = \sum \frac{(O - E)^2}{E}, which is large when observed counts differ a lot from expected counts. For two-way tables, E=row total×column totaltable totalE = \frac{\text{row total} \times \text{column total}}{\text{table total}}. Conditions are random samples and all expected counts at least 5; degrees of freedom are categories minus one, or (r−1)(c−1)(r-1)(c-1) for tables.

Key topics

Goodness of fit
One categorical variable against a hypothesised distribution; df=k−1df = k - 1.
Homogeneity
Same categorical variable across several populations or treatments.
Independence
Association between two categorical variables in one sample.
Expected counts
Computed under H0H_0; each must be at least 5.

Worked example

A die is rolled 60 times. A face appears 16 times when 10 are expected. What does that face contribute to χ2\chi^2?

  1. Contribution is (O−E)2E\dfrac{(O - E)^2}{E}.
  2. (16−10)210=3610\dfrac{(16 - 10)^2}{10} = \dfrac{36}{10}.
  3. Contribution =3.6= 3.6.

Answer: 3.63.6

Common mistakes

  • Using percentages or proportions instead of counts in the formula.
  • Checking that observed counts are at least 5 instead of expected counts.
  • Mixing up homogeneity and independence; the difference is how the data were collected.

Exam tips

  • Show at least one expected-count calculation to justify the condition.
  • When a test is significant, the largest components of χ2\chi^2 tell you which cells drove the result.

See the AP Statistics exam format and every unit on the course page.