Chi-square goodness of fit vs independence
By Jude Wallis · Published
A chi-square goodness-of-fit test checks whether one categorical variable matches a claimed set of proportions. A chi-square test for independence checks whether two categorical variables are associated. Goodness of fit is not in the Fall 2026 AP Statistics framework; independence is.
The chi-square goodness-of-fit test is not in the Fall 2026 AP Statistics framework. College Board's AP Statistics future revisions page lists it among the removed topics (old topics 8.2 and 8.3), so no current topic code applies to this comparison as a whole. The other half is assessed: the chi-square test for independence is in Unit 3, topics 3.14 and 3.15, Setting Up and Carrying Out a Chi-Square Test for Homogeneity or Independence.
Goodness of fit vs independence: the short answer
Both tests use the same statistic,
and both read the p-value from the upper tail of a chi-square distribution. They differ in how many variables are involved and where the expected counts come from.
A goodness-of-fit test has one categorical variable, measured on one sample, and a set of proportions claimed in advance. The expected counts come from that claim.
A test for independence has two categorical variables, both measured on each individual in one sample, with no proportions claimed in advance. The counts form a two-way table, and the expected counts come from the table's own row and column totals.
For AP students the split matters for a second reason. The goodness-of-fit test is not part of the Fall 2026 AP Statistics framework. College Board's future revisions page lists it among the removed topics. The test for independence remains, in topics 3.14 and 3.15.
The goodness-of-fit test
Use it when a single categorical variable has a hypothesized distribution: a die claimed to be fair, a candy mix with advertised color percentages, a population with published shares.
- Data: one row of counts, one count per category.
- Hypotheses: says the claimed proportions are all correct. says at least one of them is wrong.
- Expected counts: multiply the sample size by each claimed proportion, .
- Degrees of freedom: the number of categories minus 1.
The expected counts depend only on the sample size and the claim, so they can be written down before the data are collected. The conditions are a random sample, the 10% condition when sampling without replacement, and expected counts that are all large enough, with 5 as the usual benchmark.
This test is standard in college introductory statistics, so it is worth recognizing even though the redesigned AP exam does not assess it. The background is in is chi-square goodness of fit on the AP exam.
The test for independence
Use it when one random sample is classified by two categorical variables and the question is whether the variables are associated in the population.
- Data: a two-way table of counts, with one variable in the rows and the other in the columns.
- Hypotheses: says the two variables are independent, meaning there is no association. says they are associated.
- Expected counts: for each cell, .
- Degrees of freedom: .
No outside claim supplies the proportions here. The expected counts are what the cells would hold if the row variable and the column variable were unrelated, given the totals actually observed. That is why they cannot be computed until the data are in. The conditions are the same three: a random sample, the 10% condition, and all expected counts greater than 5.
A test for homogeneity uses this same arithmetic on a two-way table and differs in how the data were collected, as chi-square homogeneity vs independence explains.
The differences side by side
| Feature | Goodness of fit | Independence |
|---|---|---|
| Categorical variables | One | Two |
| Samples | One | One |
| Layout of the counts | A single row of categories | A two-way table |
| Null hypothesis | The claimed proportions are correct | The two variables are not associated |
| Expected count | ||
| Expected counts known before data | Yes | No |
| Degrees of freedom | Categories | |
| In the Fall 2026 AP framework | No | Yes, topics 3.14 and 3.15 |
After the expected counts, the only remaining difference is the degrees of freedom. The formula for is the same, the reference curve is a right-skewed chi-square curve in both, the p-value is the upper-tail area, and a large statistic is evidence against .
When to use which
Count the variables recorded for each individual and look for an outside claim.
- One variable and a list of claimed proportions: goodness of fit.
- Two variables on each individual in one sample, with no claimed proportions: independence.
- One variable compared across two or more separate samples or treatment groups: homogeneity, which is computed the same way as independence.
The layout of the data gives the same answer. A single row of counts can only be a goodness-of-fit setting, since a two-way table needs a second variable. A grid with row totals and column totals is a two-way table, which points to independence or homogeneity.
For the AP exam, prepare the two-way table tests. If you meet a one-variable problem with claimed proportions in an older review book, you are looking at material written for the previous course. Practice for the assessed version is at chi-square two-way practice, and you can check calculations with the chi-square calculator.
The classic mix-up and how to avoid it
The typical error is taking a rule from one test into the other. Both of these appear often:
- The wrong degrees of freedom. Categories minus 1 belongs to goodness of fit. Using it on a 2 by 3 table gives , when the correct value is . At the critical value for 5 degrees of freedom is 11.070 and for 2 it is 5.991, so the error can reverse a decision.
- The wrong expected counts. Splitting a two-way table's total evenly across the cells, or applying outside percentages to it, is goodness-of-fit thinking. In a test for independence the expected counts come from the row and column totals.
A third slip applies to both tests: entering percentages or proportions as the observed values. The chi-square statistic is computed from counts.
To keep the tests apart, ask where the expected counts come from before computing anything. If they come from a claim stated in the problem, the test is goodness of fit. If they have to be built from the table's totals, the test is independence or homogeneity.
Goodness of fit: one variable against claimed proportions
A cafeteria manager claims that lunch orders are 50% hot entree, 30% salad, and 20% sandwich. A random sample of 150 orders has 66 hot entrees, 48 salads, and 36 sandwiches. Test the claim at . This procedure is not assessed on the Fall 2026 AP exam and is shown for comparison.
Identify the setting. There is one categorical variable, type of order, and a set of claimed proportions, so this is a goodness-of-fit test.
State the hypotheses. : the proportions are 0.50, 0.30, and 0.20. : at least one of these proportions is different.
Expected counts from the claim: , , . All are greater than 5, and the sample is random.
Compute each term. Hot entree: . Salad: . Sandwich: .
Add: .
Degrees of freedom: categories minus 1, so .
The p-value is the area to the right of 2.48 on the chi-square curve with 2 degrees of freedom, which is 0.2894. Since , fail to reject .
with 2 degrees of freedom and a p-value of 0.2894. Fail to reject : the sample does not give convincing evidence that the manager's claimed proportions are wrong. The expected counts 75, 45, and 30 came from the claim, and the degrees of freedom came from the number of categories.
Independence: two variables in a two-way table
A random sample of 200 students at a large school is classified by grade level and usual lunch order. Of 120 underclass students, 66 order a hot entree, 30 a salad, and 24 a sandwich. Of 80 upperclass students, 24 order a hot entree, 30 a salad, and 26 a sandwich. Test at whether grade level and lunch order are associated.
Identify the setting. One sample is classified by two categorical variables with no claimed proportions, so this is a test for independence.
State the hypotheses. : grade level and lunch order are not associated for students at this school. : they are associated.
Find the totals. Rows: 120 and 80. Columns: hot entree, salad, sandwich. Table total: 200.
Expected counts for the underclass row: , , . For the upperclass row: , , . All are greater than 5.
Underclass terms: , , .
Upperclass terms: , , .
Add: .
Degrees of freedom: . The p-value is 0.0023. Since , reject .
with 2 degrees of freedom and a p-value of 0.0023. Reject : there is convincing evidence of an association between grade level and lunch order at this school. The expected counts came from the row and column totals, and the degrees of freedom came from the table's dimensions.
Frequently asked questions
Is the chi-square goodness-of-fit test on the AP Statistics exam?
Not from the May 2027 exam onward. College Board's future revisions page lists the chi-square goodness-of-fit test among the topics removed for the Fall 2026 course. The chi-square tests for homogeneity and independence remain, as Unit 3 topics 3.14 and 3.15.
Why are the degrees of freedom different for the two tests?
Degrees of freedom count how many cell counts are free to vary once the totals are fixed. With one row of categories and a fixed sample size, counts are free. In a two-way table every row total and column total is fixed, which leaves free cells.
What does a goodness-of-fit test with two categories reduce to?
A two-sided one-proportion z-test. With only two categories, the chi-square statistic equals the square of the one-proportion statistic computed with the claimed , and the two p-values match. That z-test is part of the AP course, in topics 3.5 through 3.7.