Key takeaway: This AP Statistics chi square lesson explains how a two-way table of counts answers a yes-or-no question about categories. A chi-square test checks whether groups share one distribution (homogeneity) or whether two variables are linked (independence). You compare observed and expected counts with \(\chi^{2}=\sum\frac{(O-E)^{2}}{E}\), find \(df=(r-1)(c-1)\), and read a p-value. The notes follow AP Statistics Unit 3 and end with context-based conclusions.
A chi-square test uses a two-way table of counts to decide whether several groups share one distribution of a categorical variable (homogeneity) or whether two variables are associated (independence). Compare observed and expected counts with \(\chi^{2}=\sum\frac{(O-E)^{2}}{E}\), use \(df=(r-1)(c-1)\), and read the p-value.
AP Statistics Chi Square Lesson: key facts
- Unit 3 of AP Statistics: chi-square tests for homogeneity and independence use a two-way table of counts.
- Expected count: \(E=\frac{\text{row total}\times \text{column total}}{\text{grand total}}\).
- Test statistic: \(\chi^{2}=\sum\frac{(O-E)^{2}}{E}\) with \(df=(r-1)(c-1)\).
- Conditions: random sampling or assignment, the 10% condition, and all expected counts at least 5.
- A conclusion names the variables in context and states whether the evidence is convincing.
What does a chi-square test do with a two-way table?
A two-way table sorts each person by two categorical variables, such as grade level and lunch choice. The chi-square test asks whether the differences between the groups are too large to blame on chance.
- Homogeneity: separate random samples from several populations (or random assignment to several treatments), one categorical response. \(H_{0}\): the response has the same distribution in every population.
- Independence: one random sample, two categorical variables recorded for each individual. \(H_{0}\): the two variables are independent in the population.
How do you find expected counts, the statistic and the degrees of freedom?
Expected counts show what the table would look like if the null hypothesis were true. Large gaps between O and E make \(\chi^{2}\) large and the p-value small.
What conditions must hold?
- Random: random samples (homogeneity), one random sample (independence), or random assignment (experiment).
- 10% condition: when sampling without replacement, each sample is less than 10% of its population.
- Large counts: every expected count is at least 5.
How do you carry out the test?
Example. Random samples of 100 students from each of three grades (each with more than 1,000 students) chose a lunch type, as in the bars above. Is the distribution of lunch choice the same for all three grades?
- State. \(H_{0}\): the distribution of lunch choice is the same in all three grades. \(H_{a}\): it is not the same for at least one grade. Use \(\alpha=0.05\).
- Plan. Chi-square test for homogeneity. The samples are random, each is under 10% of its grade, and the smallest expected count is 28.33.
- Do. Totals are 112, 103 and 85, so each row expects 37.33, 34.33 and 28.33. Then \(\chi^{2}\approx 10.617\), \(df=4\), \(p=0.0312\).
- Conclude. The p-value is less than 0.05, so reject the null hypothesis. There is convincing evidence that lunch choice is not distributed the same way in all three grades.
Chi-Square Tests for Homogeneity and Independence: frequently asked questions
What is the difference between a test for homogeneity and a test for independence?
Homogeneity compares the distribution of one categorical variable across several separate samples or treatment groups. Independence uses a single sample and asks whether two categorical variables are associated. The expected counts, statistic and degrees of freedom are calculated the same way.
How do you find the expected count for a cell?
Multiply the row total by the column total and divide by the grand total. For a row total of 70, a column total of 60 and a grand total of 150, the expected count is \(\frac{70\times 60}{150}=28\).
How many degrees of freedom does a two-way table have?
Use \(df=(r-1)(c-1)\), where r is the number of rows and c is the number of columns. A table with 3 rows and 4 columns has \((3-1)(4-1)=6\) degrees of freedom.
What does a small p-value mean in a chi-square test?
It means a statistic at least as large as the one observed would be unlikely if the null hypothesis were true. With a small p-value, reject the null hypothesis and conclude that the distributions differ or the variables are associated.
What if an expected count is less than 5?
The large counts condition fails, so the chi-square calculation may not give an accurate p-value. Collect more data, or combine categories only when the combined category still makes sense in context.
What does a chi-square test do with a two-way table?
Picture a school survey where sixth and seventh graders pick walking, biking or riding the bus. The test asks whether both grades travel in the same proportions. If they do, the observed counts should sit near the expected counts. However, large gaps push the statistic up and the p-value down. So the test measures total distance from “no difference,” cell by cell.
How do you find expected counts and degrees of freedom?
First, multiply the row total by the column total, then divide by the grand total. For a 200-person table with a row of 80 and a column of 60, the expected count is 24. Next, square each gap, divide by that cell’s expected count, and add the results. A table with 3 rows and 4 columns has \(df=2\cdot3=6\). Therefore a bigger table needs a bigger statistic to look unusual.
Which conditions must hold in an AP Statistics chi square lesson?
Look for random sampling or random assignment, the 10% condition for sampling without replacement, and expected counts of at least 5 in every cell. For instance, a 2 by 2 table with row totals 10 and 90 and column totals 20 and 80 has an expected count of 2 in one cell. As a result, the large counts condition fails. Observed counts do not matter for this check, only expected ones.
How do you carry out the test and write the conclusion?
State the hypotheses in context, check the conditions, compute the statistic, and then find the p-value. Finally, compare it with \(\alpha\) and answer in a full sentence. A p-value of 0.0175 with \(\alpha=0.05\) gives convincing evidence of an association. In contrast, a statistic of 7.5 with 3 degrees of freedom has \(p\approx0.058\), so you fail to reject. Also, never say “prove” or “cause.”
How can you rehearse chi-square tests on your own?
First, take one two-way table and run it as a homogeneity test. Then rewrite the hypotheses as an independence test, because the arithmetic stays the same. Next, compare how the two conclusions sound. After that, double every count and predict the new statistic before you calculate it.
Printable PDF · Lesson
AP Statistics Chi-Square Tests for Homogeneity and Independence lesson
Download the PDFSee every chapter on the AP Statistics math page.



















