The Chi-Square Statistic

AP Statistics · Unit 3 — Inference for Categorical Data: Proportions

One formula, three uses

$$\chi^2=\sum\frac{\left(O-E\right)^2}{E}$$

where $O$ is the observed count and $E$ the count expected if $H_0$ were true. Dividing by $E$ is what makes a discrepancy of $12$ matter a lot against an expectation of $30$ and almost nothing against an expectation of $3000$.

Always counts, never percentages. Feeding proportions into the formula gives a meaningless number.

Condition: every expected count $\ge5$. Observed counts may be small; it is the expected ones that must not be.

The distribution is right-skewed, values are non-negative, and the P-value is always the upper tail — a large $\chi^2$ means observed and expected are far apart.

OBSERVED (actual counts) 4218 3129 1743 EXPECTED (if H₀ is true) 3030 3030 3030 vs χ² = Σ (observed − expected)² / expected We divide by the expected count because a deviation of 12 on a base of 30 is large, while a deviation of 12 on a base of 3000 is nothing. Every expected count must be ≥ 5 for the test to be usable.
Chi-square compares two tables. The left table is what was actually counted; the right table is what you should see if $H_0$ were true. The $\chi^2$ statistic accumulates the squared differences cell by cell, each cell divided by its own expected count. Here the first cell deviates by $+12$ on a base of $30$ — contributing $\frac{144}{30}=4.8$, quite large. The same deviation on a base of $3000$ contributes only $0.048$.

Worked example: computing expected counts

A $2\times3$ table has row $1$ total $80$, column $2$ total $60$, and grand total $200$. Compute the expected count for the cell (row 1, column 2).

Solution

The formula for the expected count in a two-way table:

$$E=\frac{\text{row total}\times\text{column total}}{\text{grand total}}=\frac{80\times60}{200}=24$$

Meaning: if the two variables are independent, row $1$ makes up $\frac{80}{200}=40\%$ of the whole, so it should also make up $40\%$ of column $2$, that is, $0.4\times60=24$.

An expected count need not be a whole number — it is a theoretical average and can easily come out as $24.6$.

Common mistake

A decimal expected count is normal; do not round. And do not confuse: the $\ge5$ condition applies to the expected counts; an observed cell of $0$ is still valid if its expected count is large enough.

Key takeaway

Use counts. Divide by the expected count. Every expected count $\ge5$. $P$ is always in the upper tail.

← Comparing Two Proportions · All AP Statistics lessons · Practice AP Statistics questions (free, instant scoring) · Two-Way Tables: The Full Four-Step Test →