Chi-square homogeneity vs independence
By Jude Wallis · Published
The arithmetic is identical. Homogeneity compares two or more separately sampled populations or treatment groups on one categorical variable. Independence takes one sample and records two categorical variables on each unit. Only the hypotheses and the scope of the conclusion change.
AP Statistics: Unit 3 (topics 3.14 Setting Up a Chi-Square Test for Homogeneity or Independence, 3.15 Carrying Out a Chi-Square Test for Homogeneity or Independence). Both chi-square tests sit in Unit 3 topics 3.14 and 3.15 of the Fall 2026 AP Statistics course, whose titles name homogeneity and independence together. The two run identical arithmetic on a two-way table: expected count = (row total x column total)/grand total, chi-square = sum of (O - E)^2/E, and df = (rows - 1)(columns - 1). The sampling design decides the name and the hypotheses. The chi-square goodness-of-fit test was removed in the redesign, per College Board's AP Statistics future revisions page.
Homogeneity vs independence: the short answer
These two tests are the same calculation. Same two-way table, same expected counts, same statistic, same degrees of freedom, same p-value. If you hand the numbers to a calculator, it cannot tell you which test you ran.
What separates them is how the data were collected, and that is not visible in the table.
- Homogeneity: you drew two or more samples, one from each population or treatment group, and recorded one categorical variable on every unit. You ask whether that variable is distributed the same way across the groups.
- Independence: you drew one sample from one population and recorded two categorical variables on every unit. You ask whether those two variables are associated.
So the design fixes the name, the name fixes the hypotheses, and the hypotheses fix what your conclusion is allowed to say. The numbers in between never change.
What a test for homogeneity is
A test for homogeneity starts with groups that already exist before any data are collected, because you chose them. Three schools, four age brackets, two treatment arms in an experiment. You sample each group separately, and you decide how large each sample is.
One categorical variable is measured on every unit, and the question is whether its distribution is the same in every group. The hypotheses name the groups:
- : the distribution of the response variable is the same for all the populations or treatments.
- : at least one population or treatment has a different distribution.
Note the shape of . It says at least one group differs, not that all of them differ, and not which one. A significant result tells you the groups are not all alike; finding where the difference sits means going back to the cell contributions and the conditional percentages.
A randomized experiment is almost always a homogeneity setting. The treatment groups are formed by random assignment, the group sizes are fixed by the experimenter, and one response variable is recorded.
What a test for independence is
A test for independence starts with a single population and a single random sample from it. You record two categorical variables on each unit, then cross-classify the sample into a two-way table. Nobody decided in advance how many units would land in each row; the whole table is one random outcome, and only the grand total was chosen.
The hypotheses name the two variables:
- : the two variables are independent in the population.
- : the two variables are associated in the population.
An equivalent way to say is that there is no association between the variables. Association here means what it means in reading a two-way table: knowing a unit's value on one variable would change the probabilities for the other.
Because the sample came from one population, the conclusion is about that one population, and any statement about the two variables is a statement about how they occur together there.
Homogeneity vs independence side by side
| Feature | Test for homogeneity | Test for independence |
|---|---|---|
| Number of samples | Two or more, drawn separately | One |
| Number of categorical variables | One, measured in every group | Two, measured on every unit |
| What the researcher fixes | The size of each group | Only the total sample size |
| The distribution is the same across all groups | The two variables are independent | |
| At least one group's distribution differs | The two variables are associated | |
| Expected count | ||
| Statistic | ||
| Degrees of freedom | ||
| Conclusion is about | A difference between the groups | An association within one population |
The bottom half of that table is identical on both sides. That is the whole point, and it is why the AP course sets both tests inside a single pair of topics rather than teaching them as separate procedures.
Why the same formula serves both
The shared expected-count formula is not a coincidence, and the two tests reach it by different routes.
For independence, says the cell probability factors into the row probability times the column probability. Estimate each from the margins and multiply by the grand total :
For homogeneity, says every group has the same distribution, so the best estimate of the shared proportion for a category pools all the groups together: it is that column's total over the grand total. Multiply by the size of the group you are in, which is the row total:
Two different null hypotheses, one formula. From there the expected counts feed the same statistic, and the same degrees of freedom, because both nulls constrain the table by the same number of free parameters.
The conditions match too: random data, independent observations within each sample, and every expected count at least 5.
The classic mix-up and how to avoid it
The frequent error is trying to read the design off the table. You cannot. A 3 by 2 table of counts is a 3 by 2 table of counts, and the sentence that tells you which test to name is in the description of how the data were gathered, not in the grid.
Three habits fix it.
First, before touching the numbers, count the samples. One sample means independence. Two or more separately drawn samples, or treatment groups formed by random assignment, mean homogeneity.
Second, check which margin the researcher controlled, and take that from the description rather than from the grid. If the write-up says the study set the group sizes, such as 100 students from each of three schools, the rows are groups and the test is homogeneity. If it says only the grand total was set, the test is independence. Round-looking row totals prove nothing on their own: the two designs in the worked example below share one table whose row totals are 120, 100 and 80.
Third, match the conclusion to the hypotheses you wrote. A homogeneity test concludes that the groups differ, so writing "the two variables are associated" does not follow from it. An independence test concludes that two variables are associated in one population, so writing "the groups have different distributions" does not follow from that. Getting right and then describing the wrong thing loses the point that the arithmetic earned.
One more separation worth keeping straight: neither of these is the goodness-of-fit test. That one used a single row of categories against claimed proportions with , and it is no longer on the AP exam.
Where this fits in AP Statistics
Both tests live in Unit 3, Inference for Categorical Data: Proportions, and the Fall 2026 course titles cover them together:
- 3.14 Setting Up a Chi-Square Test for Homogeneity or Independence
- 3.15 Carrying Out a Chi-Square Test for Homogeneity or Independence
The word "or" in both titles is doing real work: the course names the two tests together in the same two topics. Where they part company is the design and the hypotheses, which is where you read the description and decide what you are testing. From the expected counts onward there is one procedure.
The chi-square goodness-of-fit test was removed in the redesign, listed among the removed topics on College Board's AP Statistics future revisions page, so every chi-square question you meet on the exam starts from a two-way table and is one of these two.
To practise the distinction, chi-square two-way practice works through both designs, chi-square tests explained sets out the full procedure, and the chi-square calculator checks the arithmetic once you have decided which test you are running.
One table, two designs, one calculation
A school records commute method by year group. The counts are below.
| Walks or cycles | Does not | Total | |
|---|---|---|---|
| Sophomores | 76 | 44 | 120 |
| Juniors | 57 | 43 | 100 |
| Seniors | 32 | 48 | 80 |
| Total | 165 | 135 | 300 |
Design A: separate random samples of 120 sophomores, 100 juniors, and 80 seniors were taken, and each student's commute method was recorded. Design B: one random sample of 300 students was taken from the whole school, and each student's year group and commute method were recorded. Run the appropriate test for each design at the 0.05 level.
Name the tests from the designs. Design A drew three separate samples and measured one variable, commute method, in each, so it is a test for homogeneity. Design B drew one sample and measured two variables on each student, so it is a test for independence.
Write Design A's hypotheses. : the distribution of commute method is the same for sophomores, juniors, and seniors. : at least one year group has a different distribution of commute method.
Write Design B's hypotheses. : year group and commute method are independent among students at this school. : year group and commute method are associated among students at this school.
Compute the expected counts, which are the same for both designs: . Sophomores: and . Juniors: and . Seniors: and .
Check the large-counts condition. The six expected counts are 66, 54, 55, 45, 44, and 36, and every one is at least 5, so the condition holds for either design.
Compute the six cell contributions . Sophomores: and . Juniors: and . Seniors: and .
Add them: .
Degrees of freedom: . The p-value is . On the chi-square table, sits past the entry of in the column, so , which agrees.
Conclude for Design A. Since , reject . There is convincing evidence that the distribution of commute method is not the same for all three year groups.
Conclude for Design B. Since , reject . There is convincing evidence of an association between year group and commute method among students at this school.
Describe the difference either way from the conditional percentages: of sophomores walk or cycle, against of juniors and of seniors, next to overall. The seniors row sits furthest from that overall rate and is also the smallest group, and its two cells contributed 3.2727 and 4.0000, the largest of the six. Neither design supports a cause-and-effect claim, because neither used random assignment.
Both designs give on with , and both reject at the 0.05 level. Design A concludes that the three year groups do not share one distribution of commute method; Design B concludes that year group and commute method are associated in this school's student population. Identical arithmetic, different sentences.
Naming the test from the design alone
For each study, say whether a chi-square test for homogeneity or a test for independence is appropriate, and write . (a) 200 randomly chosen adults are each asked their blood type and whether they have ever donated blood. (b) 60 seedlings are randomly assigned to three fertilizers, 20 each, and each seedling is later recorded as flowering or not. (c) Random samples of 150 customers are taken at each of two stores, and each customer is recorded as paying by card, cash, or app.
Study (a): one sample of 200 adults, two categorical variables recorded on each person, blood type and donation history. That is a test for independence. : blood type and having ever donated are independent among adults in this population.
Study (b): three treatment groups formed by random assignment, with one response variable, flowering or not, recorded in each. That is a test for homogeneity. : the distribution of flowering outcome is the same for all three fertilizers.
Study (c): two separate samples, one per store, with one variable, payment method, recorded in each. That is a test for homogeneity. : the distribution of payment method is the same at both stores.
Check what each description fixed, since that is the only place the answer lives. In (a) the study fixed only the total, 200. In (b) and (c) the study fixed the group sizes, 20 per fertilizer and 150 per store, which is what makes the rows groups rather than a random split.
Note the one place the design changes more than the wording. Study (b) uses random assignment, so a significant result there supports a cause-and-effect conclusion about the fertilizers. Studies (a) and (c) are observational, so neither can, however small the p-value.
(a) is a test for independence; (b) and (c) are tests for homogeneity. All three would use and . Only (b), with its random assignment, can support a cause-and-effect conclusion.
Frequently asked questions
Do homogeneity and independence give different answers on the same table?
No. Both use , the same , and the same degrees of freedom, so the statistic and p-value are identical. Only the hypotheses and the wording of the conclusion differ.
How do I tell which test a question wants?
Count the samples described. One sample with two categorical variables recorded on each unit is a test for independence. Two or more separately drawn samples, or treatment groups from random assignment, each measured on one categorical variable, is a test for homogeneity. The table of counts cannot tell you; only the description of the data collection can.
Is a randomized experiment homogeneity or independence?
Homogeneity. The treatment groups are created by random assignment, their sizes are set by the experimenter, and one response variable is recorded in each group, which is exactly the homogeneity structure. Random assignment is also what allows a cause-and-effect conclusion if you reject the null.
Are both tests on the AP Statistics exam?
Yes. Both are named in Unit 3 topics 3.14 Setting Up a Chi-Square Test for Homogeneity or Independence and 3.15 Carrying Out a Chi-Square Test for Homogeneity or Independence. The chi-square goodness-of-fit test was removed in the Fall 2026 redesign, so the two-way table tests are the chi-square content that remains.
Does the alternative hypothesis for homogeneity say every group differs?
No. It says at least one group has a different distribution, which is why rejecting does not identify which group is responsible. To describe the difference, compare the conditional percentages across groups and look at which cells contributed most to .