AP Statistics · Topic 3.14 · Unit 3

AP Stats 3.14: Setting Up a Chi-Square Test

By Jude Wallis · Published

Use a chi-square test for homogeneity to compare a categorical variable across two or more populations, and a test for independence to check association between two variables in one population. Chi-square distributions are right-skewed; conditions need random data and all expected counts above 5.

AP Statistics: Unit 3 (topics 3.14). CED topic 3.14 (Setting Up a Chi-Square Test for Homogeneity or Independence), skills 2.C, 2.E, 4.C, 4.E. Chi-square goodness-of-fit is not part of this course.

What topic 3.14 covers

Topic 3.14 sets up the chi-square tests for two-way tables of categorical data. You learn what a chi-square distribution looks like, choose between the test for homogeneity and the test for independence, write the hypotheses in words, and check conditions. The calculations come in topic 3.15. This is the one place in Unit 3 where the data are counts in a two-way table rather than a single proportion, so the setup looks different even though the four-step logic is the same.

Chi-square distributions

The chi-square statistic measures the distance between observed and expected counts relative to the expected counts. Chi-square distributions take only positive values and are skewed right, because the statistic is a sum of squared differences and can never be negative. The skew becomes less pronounced as the degrees of freedom increase, so larger tables produce more symmetric curves. A large chi-square value means the observed counts sit far from what the null predicts, which is what pushes the p-value down.

Homogeneity versus independence

The two tests use the same statistic but answer different questions.

  • A chi-square test for homogeneity checks whether the distribution of one categorical variable is the same across two or more populations or treatments. State it referencing the categorical variable and the populations.
  • A chi-square test for independence checks whether two categorical variables are associated in a single population sampled once. State it referencing both variables and the population.

The data structure tells you which one applies: several samples from different groups point to homogeneity, one sample measured on two variables points to independence.

Hypotheses and conditions

The hypotheses are stated in words, not symbols. For homogeneity, H0H_0 says there is no difference in the distributions across populations and HaH_a says there is a difference. For independence, H0H_0 says the two variables are not associated (independent) and HaH_a says they are associated.

Three conditions must hold: randomization (random samples or a randomized experiment), the 10% condition when sampling without replacement, and the expected counts condition, that all expected counts are greater than 5. Check expected counts, not observed counts, because the expected values are what the null model predicts. Precise responses always name the expected counts, not the observed counts, when checking this condition.

Computing an expected count

In a two-way table, one cell sits in a row with total 120 and a column with total 200, and the whole table totals 500. Find that cell's expected count and check the condition.

  1. Expected count formula: row total×column totaltable total\dfrac{\text{row total} \times \text{column total}}{\text{table total}}.

  2. Substitute: 120×200500=24000500\dfrac{120 \times 200}{500} = \dfrac{24000}{500}.

  3. Divide: 24000÷500=4824000 \div 500 = 48.

The expected count is 48, which is greater than 5. If every cell's expected count also exceeds 5, the expected counts condition is met.

Frequently asked questions

How do I tell homogeneity from independence?

Look at how the data were collected. Separate samples drawn from two or more populations call for a test of homogeneity. A single sample from one population, classified by two variables at once, calls for a test of independence.