Carrying Out a Chi-Square Test for Homogeneity or Independence
AP StatisticsΒ· 12 min read
1. Condition Verification for Chi-Square Testsβ β β βββ± 3 min
All chi-square tests for two-way tables require three core conditions to be satisfied to produce reliable results: random sampling or random assignment, independent observations (10% condition if sampling without replacement), and the large counts condition.
Large Counts Condition
All expected cell counts in the two-way table must be greater than or equal to 5. This ensures the chi-square distribution is a valid approximation for the test statistic sampling distribution.
A researcher surveys 200 randomly selected high school students across 3 grade levels to check if snack preference is associated with grade. The 3x3 two-way table has marginal totals of 70, 65, 65 for grades, and 80, 70, 50 for snack types. Verify all conditions for a chi-square test for independence.
- 1
- Random condition: Explicitly stated that 200 randomly selected students were surveyed, so this condition is satisfied.
- 2
- Independence condition: 200 is less than 10% of all high school students at the target school, so observations are independent.
- 3
- Large counts condition: The smallest expected count is (50 * 65)/200 = 16.25, which is far larger than 5, so this condition is satisfied.
What is the minimum allowed value for any expected cell count to satisfy the large counts condition?
3
5
10
20
Reveal answer
5 βAP Statistics rubrics require all expected counts β₯5 to use the chi-square approximation.
2. Calculating Expected Counts and the Chi-Square Test Statisticβ β β β ββ± 3 min
Under the null hypothesis, the expected count for each cell is calculated using the corresponding row total, column total, and overall grand total of the two-way table. The test statistic sums the squared standardized difference between observed and expected counts across all cells.
Calculate the chi-square test statistic for a 2x2 table with observed counts: 30, 20 in row 1, 25, 35 in row 2. Grand total is 110.
- 1
- Calculate marginal totals: Row 1 total = 50, Row 2 total = 60, Column 1 total = 55, Column 2 total = 55.
- 2
- Compute expected counts: E11 = (50*55)/110 = 25, E12 = 25, E21 = 30, E22 = 30.
- 3
- Sum squared standardized differences: (30-25)Β²/25 + (20-25)Β²/25 + (25-30)Β²/30 + (35-30)Β²/30 = 1 + 1 + 0.833 + 0.833 = 3.666
3. Degrees of Freedom and P-Value Calculationβ β β βββ± 3 min
Degrees of freedom for a two-way table chi-square test depends only on the number of rows and columns, not the total sample size. The p-value is always the right-tail probability above your calculated test statistic on the corresponding chi-square distribution.
Find the p-value for the earlier 2x2 table test statistic of 3.666.
- 1
- Calculate degrees of freedom: r=2, c=2, so df = (2-1)(2-1) = 1.
- 2
- Use a TI-84 ΟΒ²cdf function or chi-square table to find the right-tail probability above 3.666 for df=1.
- 3
- The resulting p-value is approximately 0.055, which is just above the standard Ξ±=0.05 significance threshold.
4. Drawing Valid Conclusions in Contextβ β ββββ± 2 min
Your conclusion must explicitly link the p-value comparison to your pre-stated null hypothesis, and avoid generic statements that do not reference the specific variables from the study. For homogeneity tests, reference distribution differences across groups; for independence tests, reference association between variables.
Write a full AP-eligible conclusion for the earlier 2x2 test with p-value = 0.055, Ξ±=0.05.
- 1
- Compare p-value to alpha: 0.055 > 0.05, so we fail to reject the null hypothesis.
- 2
- State contextual result: There is not sufficient statistically significant evidence at the Ξ±=0.05 level to conclude there is an association between the two categorical variables in the target population.
5. Common Pitfalls
Wrong move:
Using n-1 for degrees of freedom instead of (r-1)(c-1)
Why:
Confuses goodness-of-fit test degrees of freedom with two-way table chi-square degrees of freedom
Correct move:
Always subtract 1 from the number of rows and 1 from the number of columns, then multiply the two values to get df
Wrong move:
Calculating expected counts as total sample size divided by number of cells
Why:
Ignores unequal marginal totals for rows and columns, leading to heavily biased expected values
Correct move:
Compute each expected count individually using the (row total * column total)/grand total formula
Wrong move:
Claiming a statistically significant result proves a causal relationship between variables
Why:
Chi-square tests only detect statistical association, and cannot confirm causation for observational study data
Correct move:
Explicitly state that there is evidence of association, not causation, between the two variables
Wrong move:
Skipping the large counts condition check entirely in your response
Why:
AP rubrics allocate a full independent point for verifying this condition, which you will lose if omitted
Correct move:
Confirm all expected counts are β₯5 and state this explicitly before proceeding to calculations
Wrong move:
Using a two-tailed p-value for the chi-square test
Why:
The chi-square test statistic is always non-negative, so all p-values are right-tailed
Correct move:
Only calculate the probability that the chi-square distribution exceeds your observed test statistic
6. Quick Reference Cheatsheet
Step | Chi-Square Test for Homogeneity | Chi-Square Test for Independence |
|---|---|---|
Null Hypothesis | Distributions of the categorical variable are identical across all groups | No association exists between the two categorical variables |
Expected Count Formula | E = (Row Total * Column Total) / Grand Total | Same formula as homogeneity test |
Degrees of Freedom | df = (r-1)(c-1) | Same df formula as homogeneity test |
Conclusion Framing | Compare distributions across separate populations/groups | Describe association (or lack thereof) in the single sampled population |
When this came up on past exams
AI-estimated based on syllabus patterns β cross-check with official past papers for accuracy. Use only as revision-focus signals.
- 2023 Β· Paper 1
Chi-square test for independence for survey data
- 2022 Β· Paper 2
Chi-square homogeneity test across 3 groups
- 2021 Β· Paper 1
Two-way table chi-square inference full workflow
What's Next
Mastering the procedural workflow for chi-square tests for homogeneity and independence is a high-weight skill for the AP Statistics free-response section, where this topic appears in nearly 70% of recent exam administrations. You will now build on this foundation to learn how to distinguish between the two test types when presented with an unfamiliar study design, a common point of confusion that costs students multiple rubric points on exam day. You will also practice identifying when a chi-square goodness-of-fit test is the appropriate inference procedure instead of the two tests covered here, to avoid mixing up procedures in multi-part exam questions.
