Mistake Master
Student view — seeing the site as a student does
Mistake Master · AP Statistics · Unit 3 · Step-Through Animation

Setting Up a Chi-Square Test for Homogeneity or Independence

Count the Populations Sampled, Then Let the Margins Do the Arithmetic

You'll learnhow to set up a chi-square test — choosing homogeneity or independence by how the data were sampled rather than by how the table looks, computing expected counts from the row and column totals, feeding the test counts instead of percentages, checking that every expected count reaches 5, and reading the degrees of freedom off the table's shape.

Both chi-square tests run on the same two-way table and produce the same statistic, which is exactly why the choice between them has to be made deliberately: nothing in the finished arithmetic will reveal it. Three schools surveyed separately is three populations and one variable, homogeneity; one school's students classified by grade and by answer is one population and two variables, independence. After that the machine is margins all the way down — each cell's expected count is its row total times its column total over the grand total. The counts have to be counts, because 60 percent of 10 people and 60 percent of 1,000 are different evidence, and this page runs the same percentages through the same formula and watches half the evidence vanish. The condition at the end is on the expected counts, not the observed ones, which is the direction nearly everyone checks it in. Twelve short steps; press Next for each one.

12 STEPS · 6 QUICK CHECKS · HOMOGENEITY VS INDEPENDENCE · EXPECTED COUNTS · CONDITIONS AND df · v2

Expected counts come from the margins, and the condition is on them.
Before you start
What you're looking at
A two-way table: three schools' yes and no answers about a later start time, 550 students in all. Everything this topic does is built from these six cells.
The question
Which chi-square test does this call for, and what does the null say each cell should hold?
Step 1 / 12

Read all 12 steps as text
Step 1

Three schools, one question, six cells

Three high schools asked their students about a later start time: 120 of school A's 200 said yes, 90 of school B's 200 and 66 of school C's 150 — 550 students in six cells of counts.

Step 2

The finished table cannot tell you which test

Homogeneity compares two or more separately sampled populations on one variable; independence takes one sample and classifies each person on two variables — and the two produce identical-looking tables, so the design has to decide.

Step 3

The hypotheses are sentences, not symbols

\(H_0\): the distribution of responses about the later start time is the same for students at schools A, B and C. \(H_a\): it is not the same for all three — a difference somewhere, with no school and no cell named.

Step 4

Under the null, every school follows one split

The null says all three schools share a response distribution, and the best estimate of that shared split is the whole survey's own margin: 276 of the 550 students said yes.

Step 5

Expected count = row × column / grand total

School A's expected yes count is \(\frac{200 \times 276}{550} \approx 100.4\), and every violet number under an observed count is that same recipe with its own row and column — kept as a decimal, because these are predictions rather than people.

Step 6

The test measures observed against expected

Chi-square adds up, cell by cell, how far the observed count sits from the expected count — never how far one percentage sits from another.

Step 7

The same study, written as row percentages

Turn each row into percentages — 60 and 40, 45 and 55, 44 and 56 — and the table still describes the three schools faithfully, but every row is now a "sample" of 100 and the grand total has fallen to 300.

Step 8

Same pattern, half the evidence

Run the identical arithmetic on that percentage table and the statistic comes out near 6.4, against about 12.2 for the real counts: the same pattern reads as half the evidence, because the people behind it were thrown away.

Step 9

Add a thin third answer

Let the survey offer "undecided" as well, with 8 students choosing it at school A, 6 at B and 4 at C: the table is now 3 by 3, and its margins are its own — rows of 208, 206 and 154 over a grand total of 568.

Step 10

The condition is on the expected counts

School C expects \(\frac{154 \times 18}{568} \approx 4.9\) undecided students, and 4.9 is under 5, so the table fails the large-counts condition even though every observed count looked fine.

Step 11

Degrees of freedom come from the shape

\(df = (r-1)(c-1) = (3-1)(2-1) = 2\): fix the margins, choose two cells, and the other four are forced — and the 3 by 3 variant has \(df = 4\) for the same reason, whatever \(n\) happens to be.

Step 12

Count populations, then let the margins work

The design picks the test, the hypotheses are sentences, the margins mill out every expected count, the food is counts, the condition is on the expected counts, and the shape names the curve — which is where Topic 3.15 picks it up.