Expected Count vs Chi-Square Test

Both terms below come up in the same part of the course, and students mix them up. Here is each one defined on its own, side by side, so you can see where they part company.

Expected count

Hypothesis testing

An expected count is how many observations a category would get if the null hypothesis were exactly true; it is the baseline in a chi-square test.

An expected count EE is what a cell would hold on average if the null hypothesis were exactly true. In a two-way table the null says one variable tells you nothing about the other, so a cell's share of the table is its row share times its column share, and multiplying by the grand total gives E=(row total)×(column total)grand totalE = \frac{(\text{row total}) \times (\text{column total})}{\text{grand total}}. The expected counts are built from the margins of your own table, so the observed and expected tables always carry identical row totals, column totals, and grand total.

Two schools are surveyed about biking to school. School A has 45 bikers out of 100, School B 45 out of 140, so the column totals are 90 bikers and 150 non-bikers out of 240. School A bikers have E=100×90240=37.5E = \frac{100 \times 90}{240} = 37.5 and School A non-bikers E=100×150240=62.5E = \frac{100 \times 150}{240} = 62.5, which add back to that row's 100. The second row gives 52.5 and 87.5.

The objection to answer: "expected counts have to be whole numbers, because there is no such thing as 37.5 students." Round 37.5 up to 38 and the chi-square statistic changes. EE is an average across repeated samples under the null, not a forecast of any single table, and it goes into (OE)2E\frac{(O - E)^2}{E} with its decimals intact. If the expected counts fail to add back to the margins, the arithmetic is wrong.

The condition for trusting the chi-square approximation is that every expected count is at least 5, and it is checked on the expected counts, never the observed ones. A cell holding 2 observed is fine as long as its EE clears 5. When some fall short, categories get combined or more data collected rather than reading the p-value anyway.

Building these counts is AP Statistics topic 3.14, Setting Up a Chi-Square Test for Homogeneity or Independence, and topic 3.15 carries the test out. A goodness-of-fit test instead uses E=np0E = np_0 from claimed proportions, which is standard college content but no longer on the AP exam.

Full entry for expected count

Chi-square test

Hypothesis testing

A chi-square test compares observed counts of categorical data to the counts expected under a hypothesis, gauging how far the data stray from that model.

A chi-square test asks whether a table of counts sits further from a model than sampling variability explains. Every version computes χ2=(OE)2E\chi^2 = \sum \frac{(O - E)^2}{E} across the cells, where OO is an observed count and EE the expected count under the null. Squaring throws away the direction of each gap, so every discrepancy pushes the statistic up instead of cancelling another, and all the evidence against the null lives in the upper tail of the chi-square curve.

Two schools are surveyed about biking to school: School A has 45 bikers out of 100, School B 45 out of 140. The expected counts from the margins are 37.5 and 62.5 in the first row, 52.5 and 87.5 in the second, so the four terms are 1.5, 0.9, 1.0714, and 0.6429. That gives χ2=4.1143\chi^2 = 4.1143 on (21)(21)=1(2 - 1)(2 - 1) = 1 degree of freedom, and a p-value of 0.0425. At α=0.05\alpha = 0.05 that is convincing evidence the two schools differ in their biking rates.

The error that ruins the test: "School A bikes at 45 percent and School B at 32.1 percent, so those go in the formula." Percentages are not counts, and χ2\chi^2 scales with how much data stands behind it. Double both schools while holding those two percentages fixed and the statistic doubles to 8.2286 with a p-value of 0.0041. Raw counts carry the sample size; percentages discard it.

Three tests share the formula and differ in where EE comes from and how the degrees of freedom are counted. Homogeneity compares separate samples on one categorical variable, which is the table above. Independence takes one sample and cross-classifies it two ways. Both read EE off the margins and use (r1)(c1)(r - 1)(c - 1) degrees of freedom. Goodness of fit checks one variable against claimed proportions using E=np0E = np_0.

Homogeneity and independence are AP Statistics topics 3.14 and 3.15. Goodness of fit was removed from the course for Fall 2026, so it is not examinable, though it stays standard in a college introductory course.

Full entry for chi-square test

Where each one fits in the course