SECTION 1
Historical Context & Motivation
Long before modern software made hypothesis testing routine, researchers faced a fundamental question: when you observe different proportions across groups, how do you know the difference is real rather than the product of random sampling variability? In the late nineteenth century, Karl Pearson developed a single statistic—what we now call the chi-square statistic—that elegantly measures the total discrepancy between what we observe in categorical data and what we would expect if there were no association. This idea became the backbone of two closely related tests: the chi-square test for independence and the chi-square test for homogeneity.
1900 • Pearson's Chi-Square
1922 • Fisher's Correction
1954 • Cochran's Guidelines
2000s • Modern AP Curriculum
The central question these tests address is deceptively simple: Is there convincing evidence that two categorical variables are associated, or that the distribution of a categorical variable differs across populations? Answering this requires a structured hypothesis-testing procedure that converts a two-way table of counts into a single test statistic, then assesses how unusual that statistic would be if the null hypothesis were true.
SECTION 2
Core Principles & Definitions
Before executing the mechanics of a chi-square test, it is essential to distinguish the two test types and understand the logic that unites them. Both tests use the same formula and the same chi-square distribution, but they arise from different sampling designs and answer subtly different questions.
Test for Independence
Test for Homogeneity
Expected Counts
Chi-Square Statistic
Degrees of Freedom
SECTION 3
Visual Explanation
Flowchart: Carrying Out a Chi-Square Test
The flowchart above captures the backbone of every chi-square test on the AP exam. Notice that the Plan stage requires you to check two conditions: the data must come from a random process (either an SRS from a population or a randomized experiment), and all expected counts must be at least 5. If either condition fails, the chi-square approximation may be unreliable and the conclusion invalid. In the 'Do' step, you compute expected counts using the formula E = (row total × column total) / n, then plug every cell's observed and expected counts into the chi-square formula before looking up the P-value using the χ² distribution with (r − 1)(c − 1) degrees of freedom.
SECTION 4
Mathematical Framework
The mathematical machinery behind the chi-square test is elegant in its simplicity. Three formulas do all the heavy lifting: one computes expected counts, one computes the test statistic, and one determines degrees of freedom. Together they convert a table of raw counts into a single number that can be compared against a known probability distribution.
EXPECTED COUNT
For each cell in the two-way table, E is the count expected under H₀. The row total is the sum of observed counts in that cell's row, the column total is the sum in that cell's column, and n is the grand total of all observations.
CHI-SQUARE TEST STATISTIC
Sum over all cells in the table. O is the observed count and E is the expected count for each cell. Squaring ensures positive and negative deviations contribute equally; dividing by E standardizes the contribution so that cells with larger expected counts do not dominate by default.
DEGREES OF FREEDOM
Here r is the number of rows and c is the number of columns in the two-way table. The degrees of freedom determine which member of the chi-square family of distributions is used to compute the P-value.
P-VALUE
The P-value is always a right-tail probability because larger χ² values correspond to greater departure from H₀. Use a χ² distribution table or your calculator's χ²cdf function.
SECTION 5
Anatomy of Chi-Square Components
Each cell in the two-way table contributes one component to the overall chi-square statistic. Examining these individual components tells you which cells deviate most from what independence or homogeneity would predict. After rejecting H₀, it is good practice (and often requested on the AP exam) to identify the largest components and explain their direction—whether the observed count is above or below the expected count—because this provides context for the nature of the association.
The bar chart above illustrates how unevenly components can contribute. In this hypothetical 3 × 2 table, Cell (1,1) alone accounts for over half of the total χ² = 10.63. On a free-response question, identifying this cell and stating whether O exceeded or fell short of E demonstrates a deeper understanding than simply reporting χ² and the P-value. Remember: the chi-square statistic is a sum, and understanding the parts of that sum tells you where the association is strongest.
SECTION 6
Worked Example
A researcher surveys 400 randomly selected adults from three regions (North, Central, South) and records whether each person supports or opposes a proposed policy. The data are summarized below.
| Support | Oppose | Row Total | |
|---|---|---|---|
| North | 70 | 50 | 120 |
| Central | 105 | 55 | 160 |
| South | 75 | 45 | 120 |
| Col Total | 250 | 150 | 400 |
Observed counts for policy opinion by region
Worked example
- 1
Step 1 — State Hypotheses
H₀: The distribution of opinion (Support vs. Oppose) is the same for all three regions. Hₐ: The distribution of opinion is not the same for all three regions. We use α = 0.05. - 2
Step 2 — Plan: Name Test & Check Conditions
We will perform a chi-square test for homogeneity. Random: The problem states adults were randomly selected. Large Counts: We compute expected counts: E(North, Support) = 120 × 250 / 400 = 75; E(North, Oppose) = 120 × 150 / 400 = 45; E(Central, Support) = 160 × 250 / 400 = 100; E(Central, Oppose) = 160 × 150 / 400 = 60; E(South, Support) = 120 × 250 / 400 = 75; E(South, Oppose) = 120 × 150 / 400 = 45. All expected counts are ≥ 5. ✓ - 3
Step 3 — Do: Compute χ² and P-value
Compute each component (O − E)² / E: (70 − 75)²/75 = 0.333; (50 − 45)²/45 = 0.556; (105 − 100)²/100 = 0.250; (55 − 60)²/60 = 0.417; (75 − 75)²/75 = 0.000; (45 − 45)²/45 = 0.000.χ² = 0.333 + 0.556 + 0.250 + 0.417 + 0.000 + 0.000 = 1.556. df = (3 − 1)(2 − 1) = 2. Using χ²cdf(1.556, 10⁹, 2), the P-value ≈ 0.459. - 4
Step 4 — Conclude
Because the P-value (0.459) is greater than α = 0.05, we fail to reject H₀. There is not convincing evidence that the distribution of opinion on the proposed policy differs across the three regions.
SECTION 7
Homogeneity vs. Independence: Strengths & Limitations
| Feature | Test for Homogeneity | Test for Independence |
|---|---|---|
| Sampling Design | Independent random samples from 2+ populations (or groups in an experiment) | Single random sample from one population; each individual classified on two variables |
| Null Hypothesis | The distribution of the response variable is the same across all populations | The two categorical variables are independent in the population |
| Formula | χ² = Σ (O − E)² / E — identical | χ² = Σ (O − E)² / E — identical |
| Degrees of Freedom | (r − 1)(c − 1) — identical | (r − 1)(c − 1) — identical |
| Key Limitation | Cannot establish causation unless data come from a randomized experiment | Cannot establish causation; association ≠ causation for observational data |
| Conditions | Random samples/assignment; all expected counts ≥ 5 | Random sample; all expected counts ≥ 5 |
Side-by-side comparison of the two chi-square tests
SECTION 8
Connection to Advanced Methods
The chi-square test for homogeneity and independence is your first encounter with a broader family of categorical-data methods. In a college statistics course or graduate research, you will meet extensions that handle situations the basic chi-square test cannot.
| AP-Level Concept | Advanced Extension |
|---|---|
| χ² test with all expected counts ≥ 5 | Fisher's Exact Test: used when expected counts are small and the chi-square approximation is unreliable |
| Two-way table with r × c cells | Log-linear models: model complex multi-way contingency tables with three or more categorical variables simultaneously |
| χ² tests association (yes/no) | Cramér's V and odds ratios: measure the strength and direction of association, not just its existence |
| Independent observations | McNemar's test: handles paired or matched categorical data (e.g., before/after studies) |
For the AP exam, you will not be asked to perform these advanced methods, but understanding that the chi-square test has limitations—it cannot measure strength of association, it requires sufficiently large expected counts, and it assumes independent observations—prepares you to appreciate why statisticians developed these refinements. A strong conceptual grasp of the basic chi-square procedure also provides the foundation for logistic regression, which models the relationship between a categorical response and one or more explanatory variables.
SECTION 9
Practice Problems
Question 1: CONCEPTUAL
- A. Goodness-of-fit test
- B. Test for homogeneity
- C. Test for independence
- D. Two-sample z-test for proportions
- E. Paired t-test
Show answer (C)
Question 2: BASIC CALCULATION
- A. 1.00
- B. 2.00
- C. 2.40
- D. 3.00
- E. 10.00
Show answer (B)
Question 3: INTERMEDIATE
- A. Fail to reject H₀ because 9.73 < 9.488
- B. Reject H₀ because 9.73 > 5.991
- C. Fail to reject H₀ because 9.73 < 12.592
- D. Reject H₀ because 9.73 > 7.815
- E. Reject H₀ because 9.73 > 3.841
Show answer (B)
Question 4: APPLIED
Show answer
Question 5: CRITICAL THINKING