AP® Statistics · Unit 3 · Topic 3.14

Choosing Homogeneity or Independence

Chi-square tests for homogeneity and independence use the exact same arithmetic, so you choose between them by looking at how the data were collected, not at the table itself.

Both tests ask whether distributions line up, and both compute expected counts the same way, then sum (observed minus expected)2 / expected over every cell. What differs is the question behind the data. If separate random samples were drawn from several populations or groups, and then each sample was classified into categories, you are testing homogeneity: do these populations have the same distribution across categories? If a single random sample was drawn from one population and then classified by two variables at once, you are testing independence: are the two variables related, or unrelated, within that one population?

The hypotheses reflect this difference in wording even though the math is identical. For homogeneity, the null hypothesis says the distribution of the response variable is the same across every group. For independence, the null hypothesis says the two variables are independent in the population. For a table crossing 3 grade levels with 4 favorite subjects, if students were sampled separately from each grade level, the null is that the distribution of favorite subjects is the same across all three grade levels, and the alternative is that at least one grade level differs. If instead one sample of students was taken and each student classified by grade level and favorite subject, the null is that grade level and favorite subject are independent, and the alternative is that they are associated.

This sits right after the mechanics of the chi-square statistic and degrees of freedom, which stay (rows minus 1) times (columns minus 1) no matter which test you run. Getting the design right matters for writing hypotheses and conclusions in the correct language, even though it changes nothing about the calculation.

Key terms

Test for homogeneity
A chi-square test comparing whether several populations or groups share the same distribution of a categorical variable.
Test for independence
A chi-square test checking whether two categorical variables are unrelated within a single sampled population.
Expected count
The count a cell would have if the null hypothesis were exactly true, calculated from row and column totals.
Degrees of freedom
For a two-way table, the number of rows minus 1 times the number of columns minus 1.

Watch it explained

  1. How it worksWalk me through choosing homogeneity or independence from how the data were collected.
  2. Worked exampleFind the hypotheses for a table of 3 grade levels crossed with 4 favorite subjects.
  3. Common mistakeWhy isn't the choice between the two tests visible in the two-way table itself?

Check yourself

Your turn1 of 2
A table crosses 4 grade levels with 5 favorite subjects. Find the degrees of freedom for the chi-square test.

End of topic.