Carrying out a chi-square test for homogeneity or independence means calculating the chi-square statistic from observed and expected counts, finding the p-value using the right degrees of freedom, and stating a conclusion in context. You compare the p-value to your significance level to decide whether to reject the null hypothesis, and you never "accept" anything.
Why This Matters for the AP Statistics Exam
Chi-square tests for two-way tables show up in AP Statistics whenever you are handed a contingency table and asked whether two categorical variables are associated (independence) or whether a distribution is the same across groups (homogeneity). This topic builds on the setup work from earlier in Unit 8: once your hypotheses and conditions are in place, this is where you actually compute and conclude.
On both multiple-choice and free-response style problems, you need to recognize the right procedure, show the test statistic and degrees of freedom clearly, report the p-value, and write a conclusion linked directly to that p-value. Clear notation and context make your reasoning easy to follow, which matters for full-credit free-response work.

Key Takeaways
- The test statistic is , summed over every cell in the two-way table.
- Degrees of freedom equal (number of rows - 1)(number of columns - 1).
- The p-value is the probability of getting a chi-square statistic as large or larger than yours, assuming the null hypothesis is true. It is right-tailed.
- Compare the p-value to your significance level : if it is smaller, reject the null; if not, fail to reject.
- Write conclusions with nondeterministic language. Never say you "accept" the null or that there is "no association."
- Always tie your conclusion back to context, naming the variables or populations from the question.
The Chi-Square Statistic
After choosing the correct test, checking conditions, and writing your hypotheses, you carry out the test. Like the goodness-of-fit test, this has two main numerical pieces: the chi-square statistic and the p-value.
The chi-square statistic compares the observed counts in your contingency table to the expected counts, which come from assuming the null hypothesis is true. The formula is:
where is the observed count and is the expected count. You sum this across all cells in the table.
This formula is on the formula sheet provided for the exam. In practice, a graphing calculator computes the statistic for you once you enter the observed counts as a matrix, but you should still understand what the formula is doing: measuring how far observed counts fall from expected counts, relative to the expected counts.
Degrees of Freedom
Find degrees of freedom by subtracting 1 from the number of rows, subtracting 1 from the number of columns, and multiplying those results:
(number of rows - 1)(number of columns - 1)
For a table with 3 rows and 4 columns:
- Rows: 3 - 1 = 2
- Columns: 4 - 1 = 3
- Degrees of freedom: 2 * 3 = 6
So a 3-by-4 table has 6 degrees of freedom.
Finding the P-Value
Once you have the chi-square statistic, find the p-value: the probability of getting a chi-square value at least as extreme as yours, assuming the null hypothesis is true. The chi-square test is right-tailed, so the p-value is the proportion of the chi-square distribution (with your degrees of freedom) that is at or above your test statistic.
You can get the p-value from a chi-square table or from technology. If you use a calculator to run the test, write down both the chi-square value and the p-value from the output so your work is clear.
Drawing a Conclusion
As with hypothesis tests in earlier units, compare your p-value to a given :
- If the p-value is less than , reject . You have convincing evidence for .
- If the p-value is greater than , fail to reject . You do not have convincing evidence for .
Two reminders:
- Never "accept" anything.
- Include context.
Example conclusion: "Since our p-value (about 0) is less than 0.05, we reject the null hypothesis. We have convincing evidence that there is an association between the two variables in the population of interest."
Conclusion Template
- First part: "Since our (p-value) is less than / greater than 0.05, we reject / fail to reject our null."
- Second part, test for independence: "We have / do not have convincing evidence that there is an association between variable x and variable y in our intended population."
- Second part, test for homogeneity: "We have / do not have convincing evidence that the distribution of categorical variable x is different across population x and population y."
How to Use This on the AP Statistics Exam
Problem Solving
- Enter your observed counts into a matrix and run the chi-square test on your calculator, then record both the chi-square statistic and the p-value.
- Show the degrees of freedom using (rows - 1)(columns - 1) so a reader can follow your setup.
- Remember the test is right-tailed, so a larger chi-square statistic means a smaller p-value.
Free Response
- State your conclusion in two parts: the reject / fail to reject decision linked to the p-value, then the meaning in context.
- Name the actual variables or populations from the prompt instead of writing "variable x" and "variable y."
- Use nondeterministic language. For a large p-value, say there is not enough evidence of an association or difference, not that the variables are independent or identical.
Common Trap
- Mixing up homogeneity and independence in your conclusion. Independence talks about an association between two variables in one population. Homogeneity talks about whether a distribution is the same across different populations or treatments.
Common Misconceptions
- "A large p-value proves the variables are independent." It does not. You can only say there is not enough evidence of an association. Failing to reject is not the same as accepting the null.
- "I can use observed counts to check the large counts condition." The condition is about expected counts. All expected counts should be at least 5.
- "Degrees of freedom is the sample size minus 1." For a two-way table, it is (rows - 1)(columns - 1), not based on sample size.
- "The chi-square test can be two-tailed." The chi-square test for two-way tables is right-tailed. The p-value always comes from the upper tail.
- "Independence and homogeneity are the same test with the same conclusion." They use the same statistic and formula, but the hypotheses and the way you describe the result differ, since independence involves one population and homogeneity compares groups.
Related AP Statistics Guides
Vocabulary
The following words are mentioned explicitly in the College Board Course and Exam Description for this topic.Term | Definition |
|---|---|
chi-square distribution | A probability distribution used in chi-square tests, characterized by degrees of freedom and used to determine p-values for test statistics. |
chi-square statistic | A test statistic that measures the distance between observed and expected counts relative to the expected counts. |
chi-square test for homogeneity | A statistical test used to determine whether the distributions of a categorical variable are the same across different populations or treatments. |
chi-square test for independence | A statistical test used to determine whether two categorical variables in a population are associated or independent. |
degrees of freedom | A parameter of the t-distribution that affects its shape; as degrees of freedom increase, the t-distribution approaches the normal distribution. |
expected count | The theoretical frequency in each cell of a contingency table that would be expected if the null hypothesis of independence or homogeneity were true. |
null hypothesis | The initial claim or assumption being tested in a hypothesis test, typically stating that there is no effect or no difference. |
observed count | The actual frequency or number of observations in each cell of a contingency table from the collected data. |
p-value | The probability of observing a test statistic as extreme as or more extreme than the one calculated from the sample data, assuming the null hypothesis is true. |
probability model | A mathematical framework that describes the probability distribution of outcomes under specified assumptions. |
reject the null hypothesis | The decision made when the p-value is less than or equal to the significance level, indicating sufficient evidence against the null hypothesis. |
research question | The specific question about a population or populations that a statistical test is designed to answer. |
significance level | The threshold probability (α) used to determine whether to reject the null hypothesis in a significance test. |
test statistic | A calculated value used to determine whether to reject the null hypothesis in a hypothesis test, computed from sample data. |
two-way table | A table that displays the frequency distribution of two categorical variables, organized in rows and columns. |
Frequently Asked Questions
What statistic do I use for chi-square tests of homogeneity or independence?
Use the chi-square statistic, which sums (observed count minus expected count)^2 divided by expected count across every cell in the two-way table.
How do I find degrees of freedom for a two-way chi-square test?
Degrees of freedom equal (number of rows - 1)(number of columns - 1). For example, a 3 by 4 table has (3 - 1)(4 - 1) = 6 degrees of freedom.
How do I find the p-value for a chi-square test?
Use the chi-square distribution with the correct degrees of freedom, usually through a calculator, table, or technology. The p-value is the area to the right of the observed chi-square statistic.
How do I interpret the p-value for a chi-square test?
The p-value is the probability, assuming the null hypothesis and model are true, of getting a chi-square statistic as large as or larger than the one observed.
How do I write a chi-square test conclusion on AP Statistics FRQs?
Compare the p-value to alpha, make a reject or fail-to-reject decision, and state the conclusion in context. Say there is convincing evidence or not convincing evidence for the association or difference.
What is the difference between homogeneity and independence conclusions?
Independence conclusions describe whether two categorical variables are associated in one population. Homogeneity conclusions describe whether the distribution of a categorical variable differs across populations or treatments.