7m left·0%
Reading Time: 7 min
Last Updated: September 7, 2026
Main Ideas: 5
Reading Time: 7 min
Last Updated: September 7, 2026
Main Ideas: 5

Topic 3.14 Notes – Setting Up a Chi-Square Test for Homogeneity or Independence

Verified for 2027 AP® Statistics Exam
Read aloud
Chi-square tests for homogeneity and independence are used with categorical data in a two-way table. This topic is about choosing the right chi-square test, writing the hypotheses in context, and checking the conditions that make the test valid.

What Chi-Square Tests in a Two-Way Table

A chi-square test works with a table of counts. Each cell shows how many individuals fall into that combination of categories.

You compare observed counts from the data to expected counts from the null model. The null model says what the table should look like if H0H_0 were true.

The chi-square statistic measures how different the observed and expected counts are:

χ2=∑(O−E)2E \chi^2=\sum \frac{(O-E)^2}{E}

  • For one cell, the contribution is (O−E)2E\frac{(O-E)^2}{E}.
  • The total χ2\chi^2 adds those contributions across all cells.
  • If observed and expected counts are close, χ2\chi^2 stays small.
  • If they differ a lot, χ2\chi^2 gets large.

A bigger chi-square statistic means more disagreement with H0H_0, so the p-value is always right-tailed.

Expected counts can be decimals. That is normal because they are model-based predictions, not actual observed people.

The graph below shows chi-square distributions for several degrees of freedom.

Study guide illustration

Chi-square distributions for several degrees of freedom

Chi-square distributions have a few features you need to know:

  • values are never negative
  • shape is skewed right
  • as degrees of freedom increase, the curve becomes less skewed

Choosing Between Homogeneity and Independence

The math is the same for both tests. The name depends on how the data were collected.

Homogeneity

A chi-square test for homogeneity compares the distribution of one categorical variable across two or more populations or treatment groups.

Examples:

  • Compare favorite music genre across grades 9, 10, 11, and 12
  • Compare response categories across treatment groups in an experiment

Language clue: Do these groups have the same distribution?

Independence

A chi-square test for independence checks whether two categorical variables are associated in one population.

Example:

  • From one random sample of students, record grade level and whether each student has a part-time job

Language clue: Are these two variables associated? or Are they independent?

Quick rule

  • One sample, two variables, one population → independence
  • Multiple samples or randomized groups, one response variable → homogeneity

A common trap is the phrase independent random samples. That can appear in a homogeneity problem. It describes sampling method, not the name of the test.

Hypotheses and Expected Counts

Chi-square hypotheses are written in words and context. You do not write them with means or one proportion.

Homogeneity hypotheses

  • H0H_0 The distribution of the categorical variable is the same across the populations or treatments.
  • HaH_a The distributions are not all the same.

That means at least one group differs. It does not tell you which one.

Independence hypotheses

  • H0H_0 The two categorical variables are independent in the population.
  • HaH_a The two categorical variables are associated in the population.

Expected counts for any cell come from

E=(row total)(column total)table total E=\frac{(\text{row total})(\text{column total})}{\text{table total}}

If a row total is 40, a column total is 30, and the grand total is 120, then

E=(40)(30)120=10 E=\frac{(40)(30)}{120}=10

For homogeneity, expected counts show what the table would look like if all groups had the same distribution. For independence, they show what the table would look like if the variables were unrelated.

Conditions for a Chi-Square Test

You need three conditions.

  1. Randomization

    • Independence test uses one random sample.
    • Homogeneity test uses independent random samples or random assignment in an experiment.
  2. 10% condition

    • If sampling without replacement, check n≤0.10Nn \le 0.10N.
    • For homogeneity with separate samples, check each sample against its population.
    • You do not need this for a randomized experiment.
  3. Large expected counts

    • Every expected count must be greater than 5.
    • Check expected counts, not observed counts.

If a condition fails, the standard chi-square procedure is not justified.

How to Set Up the Test and Avoid Common Mistakes

When you set up the test, keep the logic in this order:

  1. Identify the observational units and the categorical variables.
  2. Decide whether the design gives homogeneity or independence.
  3. State H0H_0 and HaH_a in context.
  4. Check randomization, the 10% condition if needed, and expected counts >5>5.
  5. Compute expected counts if asked.

Common mistakes show up a lot on quizzes and FRQs:

  • using percents instead of counts in the table
  • picking the test from the table alone instead of from the study design
  • saying H0H_0 is that “all cell counts are equal”
  • writing a directional alternative like “Group A is higher”
  • saying a significant result proves causation from a random sample
  • saying fail to reject H0H_0 proves the variables are independent

Key Takeaways

Chi-square tests use counts in a two-way table, never percentages or proportions as the actual data.
The test name comes from the study design, not from the table’s appearance.
For homogeneity, H0H_0 says the distributions are the same across groups.
For independence, H0H_0 says the two categorical variables are independent in one population.
Expected counts use E=(row total)(column total)table totalE=\frac{(\text{row total})(\text{column total})}{\text{table total}} and can be decimals.
The chi-square statistic χ2=∑(O−E)2E\chi^2=\sum \frac{(O-E)^2}{E} is always nonnegative, so the p-value is right-tailed.
The expected-count condition is every expected count >5>5, not every observed count.
Failing to reject H0H_0 does not prove independence or prove the distributions are identical.

AP® is a trademark registered by the College Board, which is not affiliated with, and does not endorse this website.

Notes

1 credit used · 5/5 remaining