Study Guide

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.

📘 Definition

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.

📐 Worked Example

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. 1
    1. Random condition: Explicitly stated that 200 randomly selected students were surveyed, so this condition is satisfied.
  2. 2
    1. Independence condition: 200 is less than 10% of all high school students at the target school, so observations are independent.
  3. 3
    1. Large counts condition: The smallest expected count is (50 * 65)/200 = 16.25, which is far larger than 5, so this condition is satisfied.
✓ Quick check
  1. 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.

E=(Row Total)×(Column Total)Grand TotalE = \frac{(\text{Row Total}) \times (\text{Column Total})}{\text{Grand Total}}
χ2=∑(O−E)2E\chi^2 = \sum \frac{(O - E)^2}{E}
📐 Worked Example

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. 1
    1. Calculate marginal totals: Row 1 total = 50, Row 2 total = 60, Column 1 total = 55, Column 2 total = 55.
  2. 2
    1. Compute expected counts: E11 = (50*55)/110 = 25, E12 = 25, E21 = 30, E22 = 30.
  3. 3
    1. 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.

df=(r−1)(c−1)df = (r - 1)(c - 1)
📐 Worked Example

Find the p-value for the earlier 2x2 table test statistic of 3.666.

  1. 1
    1. Calculate degrees of freedom: r=2, c=2, so df = (2-1)(2-1) = 1.
  2. 2
    1. Use a TI-84 χ²cdf function or chi-square table to find the right-tail probability above 3.666 for df=1.
  3. 3
    1. 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.

📐 Worked Example

Write a full AP-eligible conclusion for the earlier 2x2 test with p-value = 0.055, α=0.05.

  1. 1
    1. Compare p-value to alpha: 0.055 > 0.05, so we fail to reject the null hypothesis.
  2. 2
    1. 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

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.

Finished the guide? Put it into practice.

Choose your course to revise with illustrated notes and concept cards, then test what you know with a quiz.

Choose your course and start learning