AP STATISTICS • INFERENCE FOR CATEGORICAL DATA: PROPORTIONS

Setting Up a Test for the Difference of Two Population Proportions

Learn to formulate hypotheses, verify conditions, and construct the test statistic for comparing two proportions.

Historical Context & Motivation

The desire to compare two groups—whether two medical treatments, two campaign strategies, or two manufacturing processes—has driven statistical methodology for well over a century. Early comparative studies were limited by the absence of formal inferential frameworks, and researchers often relied on informal judgments about whether observed differences were "real" or simply the product of sampling variability. The development of hypothesis testing for the difference of two proportions emerged from a broader intellectual tradition that sought to formalize how we reason under uncertainty when comparing categorical outcomes across independent groups.

1900s
Karl Pearson's Chi-Square Test
Karl Pearson introduced the chi-square goodness-of-fit test, providing one of the first rigorous methods for analyzing categorical data and laying groundwork for comparing proportions across groups.
1920s
Fisher & Neyman–Pearson Frameworks
Ronald Fisher formalized significance testing, while Jerzy Neyman and Egon Pearson developed the competing framework of hypothesis testing with Type I and Type II errors, null and alternative hypotheses, and rejection regions.
1930s–40s
Large-Sample Z-Tests
As the Central Limit Theorem's implications were more widely appreciated, statisticians formalized normal-approximation-based z-tests for proportions, including the two-sample version using a pooled estimate under the null hypothesis.
1960s–80s
Biostatistics & Clinical Trials
Randomized controlled trials in medicine made the two-proportion z-test a standard tool for comparing success rates of treatments, spurring widespread adoption and refinement of the checking conditions we use today.
2000s–Now
AP Statistics & Modern Pedagogy
The AP Statistics curriculum codified the four-step inference process—state, plan, do, conclude—making the setup of a two-proportion z-test a core competency tested on every exam.

The central question this lesson addresses is deceptively simple: Is there convincing statistical evidence that two populations differ with respect to the proportion possessing some characteristic? Before any calculation, the answer hinges on how carefully we set up the test—defining hypotheses, verifying conditions, and identifying the correct test statistic. A flawed setup invalidates every subsequent computation, no matter how precise.

Core Principles & Definitions

Setting up a two-proportion z-test requires mastery of several interconnected ideas. Each principle below plays a specific role in ensuring the test is valid and the conclusions it supports are trustworthy. Taken together, they form the blueprint you follow before touching your calculator.

1

Parameter Identification

Define p1 and p2 as the true population proportions of interest. Always state what each parameter represents in context.
2

Hypotheses (H₀ and Hₐ)

The null hypothesis always asserts p1 − p2 = 0 (no difference). The alternative may be two-sided (≠) or one-sided (< or >), dictated by the research question.
3

Conditions for Inference

Three conditions must hold: (1) Random — both samples are independently and randomly selected or come from random assignment, (2) Independent — the 10% condition for each sample, (3) Normal — the Large Counts condition using the pooled proportion.
4

Pooled Proportion (p̂c)

Under H₀, the two populations share one proportion, so we pool successes: p̂c = (X₁ + X₂) / (n₁ + n₂). This combined estimate is used when computing the standard error of the test statistic.
5

Test Statistic & Decision

The z-statistic measures how many standard errors the observed difference p̂₁ − p̂₂ lies from the hypothesized difference of 0. We compare the resulting p-value to the significance level α to draw a conclusion.
KEY TAKEAWAY
Think of the two-proportion z-test setup like the pre-flight checklist a pilot completes before takeoff. The hypotheses are your flight plan (where you expect to go), the conditions are your instrument checks (are systems safe to proceed?), and the pooled proportion is your fuel calculation (shared resources under the assumption both engines draw from the same supply). Skipping any step risks an invalid "flight"—a conclusion you cannot trust.

Visual Explanation: Anatomy of the Setup

The following diagram illustrates the complete workflow for setting up a two-proportion z-test. Each stage feeds into the next: you begin by identifying the parameter and stating hypotheses, then verify the three conditions, compute the pooled proportion, and finally construct the test statistic. The diagram emphasizes that the pooled proportion only makes sense under the null hypothesis, which is why it appears after the conditions check but before the z-calculation.

The five-stage workflow begins with defining the parameters in context and ends with computing the z-statistic. Notice that the pooled proportion (stage 4) uses the combined successes from both samples, reflecting the null hypothesis assumption that p₁ = p₂.

The diagram makes explicit that the conditions check is a gate: if any of the three conditions fails, we cannot proceed with the normal-approximation z-test. On the AP exam, failing to verify conditions—or verifying them incorrectly—is one of the most common reasons students lose points on free-response questions. Pay particular attention to the Large Counts condition: because we are testing H₀: p₁ − p₂ = 0, we use the pooled proportion p̂c (not the individual sample proportions) when checking that each expected count is at least 10.

Mathematical Framework

The mathematical backbone of the two-proportion z-test rests on the sampling distribution of the difference p̂₁ − p̂₂. When both samples are large enough and drawn independently, this difference is approximately normal. Under the null hypothesis that p₁ = p₂, we pool the two samples to obtain a single estimate of the common proportion, which in turn determines the standard error.

NULL AND ALTERNATIVE HYPOTHESES
H₀: p₁ − p₂ = 0 Hₐ: p₁ − p₂ ≠ 0 (or < 0, or > 0)
p1 = true proportion of successes in Population 1; p2 = true proportion of successes in Population 2. The null always claims no difference; the alternative's direction depends on the research question.
POOLED SAMPLE PROPORTION
p̂c = (X₁ + X₂) / (n₁ + n₂)
X1 = number of successes in sample 1; X2 = number of successes in sample 2; n1 and n2 are the respective sample sizes. This pooled estimate assumes H₀ is true (both populations share the same p).
STANDARD ERROR (POOLED)
SE = √[ p̂c(1 − p̂c)(1/n₁ + 1/n₂) ]
The standard error quantifies the expected variability of p̂₁ − p̂₂ if H₀ were true. Because we assume a common proportion, p̂c replaces the separate sample proportions in the formula.
TEST STATISTIC
z = (p̂₁ − p̂₂ − 0) / √[ p̂c(1 − p̂c)(1/n₁ + 1/n₂) ]
The numerator is the observed difference minus the hypothesized difference (0 under H₀). The denominator is the pooled standard error. Under the null, this statistic follows approximately a standard normal distribution, N(0, 1).
💡 Why Pool?
When we test H₀: p₁ = p₂, we are assuming the two populations have the same proportion. Using the pooled p̂c to compute SE reflects that assumption—it gives a single best estimate of the common proportion. This is different from a confidence interval for p₁ − p₂, where we do not assume equality and therefore use the unpooled standard error with separate sample proportions.

Conditions in Detail

The three conditions for performing a two-proportion z-test—Random, Independent (10%), and Normal (Large Counts)—each serve a distinct mathematical purpose. The AP scoring rubric consistently requires you to name, check, and justify each condition in context. A generic statement like "all conditions are met" earns no credit; you must show the arithmetic and connect it to the problem's scenario.

Each column represents one of the three conditions. The Random condition ensures unbiased estimates, the Independent (10%) condition validates the SE formula, and the Normal (Large Counts) condition justifies using the z-distribution. Note that Large Counts uses the pooled p̂c, not the individual sample proportions.
⚠️ Common AP Exam Pitfall
Many students check the Large Counts condition using the individual sample proportions p̂₁ and p̂₂ instead of the pooled proportion p̂c. This is appropriate for a confidence interval (where no null hypothesis assumes equality), but for a significance test where H₀: p₁ = p₂, the pooled proportion must be used. On free-response questions, using the wrong proportion here will cost you a point.

When the problem describes an experiment with random assignment, the Random condition is satisfied by the act of randomly assigning subjects to treatments—not by random sampling from a larger population. This distinction matters for the scope of your conclusion: random assignment supports causal claims about the treatment, while random sampling supports generalization to the population. When both are present, you can make causal claims that generalize.

Worked Example

A researcher wants to determine whether the proportion of adults who support a new city recycling program differs between two neighborhoods. A random sample of 180 adults from Neighborhood A finds that 108 support the program, while a random sample of 220 adults from Neighborhood B finds that 110 support it. Set up the test at the α = 0.05 significance level.

Two-Proportion Z-Test Setup
1
Step 1 — Define ParametersLet p₁ = the true proportion of all adults in Neighborhood A who support the recycling program. Let p₂ = the true proportion of all adults in Neighborhood B who support the recycling program.
2
Step 2 — State HypothesesH₀: p₁ − p₂ = 0 (There is no difference in the true proportions of adults who support the program between the two neighborhoods.) Hₐ: p₁ − p₂ ≠ 0 (There is a difference.) We use a two-sided alternative because the researcher is looking for any difference, not a specific direction.
3
Step 3 — Compute Sample Statisticsp̂₁ = 108/180 = 0.600. p̂₂ = 110/220 = 0.500. The pooled proportion: p̂c = (108 + 110)/(180 + 220) = 218/400 = 0.545.
p̂₁ = 0.600, p̂₂ = 0.500, p̂c = 0.545
4
Step 4 — Check ConditionsRandom: The problem states both are random samples. ✓ Independent (10%): It is reasonable to assume each neighborhood has more than 1,800 and 2,200 adults respectively, so n₁ ≤ 10% of N₁ and n₂ ≤ 10% of N₂. Also, the two samples are from different neighborhoods and are independent of each other. ✓ Normal (Large Counts): Using p̂c = 0.545: n₁p̂c = 180(0.545) = 98.1 ≥ 10 ✓; n₁(1 − p̂c) = 180(0.455) = 81.9 ≥ 10 ✓; n₂p̂c = 220(0.545) = 119.9 ≥ 10 ✓; n₂(1 − p̂c) = 220(0.455) = 100.1 ≥ 10 ✓. All four counts exceed 10.
All three conditions are satisfied.
5
Step 5 — Identify the Test and Compute the Test StatisticWe will perform a two-proportion z-test. SE = √[0.545(0.455)(1/180 + 1/220)] = √[0.247975 × 0.01010] = √[0.002505] ≈ 0.05005. z = (0.600 − 0.500)/0.05005 ≈ 0.100/0.05005 ≈ 1.998.
z ≈ 2.00
6
Step 6 — Obtain the p-value and ConcludeFor a two-sided test, p-value = 2 × P(Z ≥ 2.00) = 2 × 0.0228 = 0.0456. Since 0.0456 < 0.05 = α, we reject H₀. There is convincing statistical evidence at the α = 0.05 level that the true proportions of adults supporting the recycling program differ between Neighborhood A and Neighborhood B.
p-value ≈ 0.046; reject H₀.

Test vs. Confidence Interval: Key Differences

Students often conflate the setup for a two-proportion z-test with that of a two-proportion z-interval. While both procedures compare p₁ and p₂, they differ in a critical way: the test assumes equality under H₀ and therefore pools, while the confidence interval makes no such assumption. The table below crystallizes these differences.

Comparison of the two-proportion z-test and the two-proportion z-interval
FeatureTwo-Proportion Z-TestTwo-Proportion Z-Interval
GoalTest whether p₁ − p₂ = 0Estimate the value of p₁ − p₂
HypothesesH₀: p₁ − p₂ = 0 vs. HₐNo hypotheses stated
Standard ErrorUses pooled p̂c in SE formulaUses separate p̂₁ and p̂₂ in SE formula
Large Counts CheckAll four counts use p̂cUse individual p̂₁ and p̂₂ for each sample
Outputz-statistic and p-valueInterval: (p̂₁ − p̂₂) ± z* × SE
KEY TAKEAWAY
The single most important distinction is whether you pool. In a significance test, the null hypothesis hands you the assumption that both populations share one proportion—so you pool the data into p̂c and use it everywhere: in the SE and in the Large Counts check. In a confidence interval, you have no such assumption, so each sample retains its own proportion. This is analogous to a forensic analysis: the test asks "Are these two fingerprints from the same person?" (assume same source), while the interval asks "How different are these two fingerprints?" (no such assumption).

Connection to Chi-Square and Advanced Methods

The two-proportion z-test is a special case of the broader chi-square test for homogeneity. When you compare two proportions (two groups, one binary variable), squaring the z-statistic yields the chi-square statistic with 1 degree of freedom: z² = χ². Understanding this relationship reveals why the AP curriculum positions the two-proportion z-test as a bridge between single-proportion inference and the chi-square tests you encounter later in the course.

Two-Proportion Z-Test vs. Chi-Square Test of Homogeneity
FeatureTwo-Proportion Z-TestChi-Square Test of Homogeneity
Number of GroupsExactly 22 or more
Number of CategoriesExactly 2 (binary outcome)2 or more
Alternative HypothesisCan be one-sided or two-sidedAlways two-sided (non-directional)
Test Statisticz (standard normal)χ² with df = (r − 1)(c − 1)
When to UseDirectional hypotheses or exactly 2 groups with binary response3+ groups or 3+ response categories

In more advanced settings beyond AP Statistics, researchers employ logistic regression to model the relationship between a binary outcome and multiple predictor variables simultaneously. The two-proportion z-test can be viewed as the simplest logistic regression: a single binary predictor (group membership) predicting a binary response. Recognizing this hierarchy—z-test → chi-square → logistic regression—helps you appreciate where each tool fits in the statistician's toolkit and motivates the study of multivariable methods in subsequent courses.

Practice Problems

1
When setting up a two-proportion z-test with H₀: p₁ − p₂ = 0, why do we use the pooled sample proportion p̂c rather than the individual sample proportions p̂₁ and p̂₂ to compute the standard error?
2
In a two-proportion z-test, Sample 1 has n₁ = 200 with X₁ = 80 successes, and Sample 2 has n₂ = 300 with X₂ = 105 successes. What is the pooled proportion p̂c?
3
A researcher randomly selects 150 patients from Hospital A and 200 patients from Hospital B to compare infection rates after surgery. In Hospital A, 27 patients developed infections; in Hospital B, 30 did. The researcher sets up a two-proportion z-test. Which of the following correctly checks the Large Counts condition?
PROBLEM 4APPLIED
A pharmaceutical company conducted a randomized experiment to test whether a new drug reduces the proportion of patients who experience migraines. Of the 250 patients randomly assigned to the drug group, 45 experienced a migraine within 30 days. Of the 250 patients randomly assigned to the placebo group, 70 experienced a migraine within 30 days. Set up an appropriate significance test to determine whether the drug is effective at reducing migraines. Include: (a) a statement of hypotheses with defined parameters, (b) identification of the appropriate test, (c) verification of all conditions, and (d) computation of the test statistic.
PROBLEM 5CRITICAL THINKING
A statistics student sets up a two-proportion z-test to compare the proportion of students who passed a standardized exam at two schools. School A: 40 out of 50 students passed. School B: 35 out of 50 students passed. The student uses p̂₁ = 0.80, p̂₂ = 0.70, and p̂c = 0.75 and computes the following Large Counts check: n₁p̂₁ = 40 ≥ 10, n₁(1 − p̂₁) = 10 ≥ 10, n₂p̂₂ = 35 ≥ 10, n₂(1 − p̂₂) = 15 ≥ 10. (a) Identify and explain the error in the student's conditions check. (b) Perform the correct conditions check and state whether the Normal condition is satisfied. (c) Discuss whether the 10% condition is likely met, and explain what additional information would be needed to verify it. (d) Suppose the Random condition is not met because both samples were convenience samples of students who happened to be present on test day. Explain how this affects the validity of any conclusion from the test.

Lesson Summary

Setting up a test for the difference of two population proportions begins with clearly defining the parameters p₁ and p₂ in context, then stating the null hypothesis H₀: p₁ − p₂ = 0 alongside an appropriate alternative hypothesis (two-sided, left-tailed, or right-tailed) dictated by the research question. Three conditions must be verified: the Random condition (both samples obtained via random sampling or random assignment), the Independent (10%) condition (each sample is no more than 10% of its population, and the two samples are independent of each other), and the Normal (Large Counts) condition using the pooled proportion p̂c so that all four expected counts (n₁p̂c, n₁(1 − p̂c), n₂p̂c, n₂(1 − p̂c)) are at least 10.

The pooled proportion p̂c = (X₁ + X₂)/(n₁ + n₂) is used because H₀ assumes the two populations share a common p—a critical distinction from the two-proportion z-interval, which uses unpooled standard error. The resulting test statistic z = (p̂₁ − p̂₂) / √[p̂c(1 − p̂c)(1/n₁ + 1/n₂)] follows approximately a standard normal distribution under H₀, yielding a p-value that is compared to the chosen significance level α. Remember: on the AP exam, the setup—hypotheses, conditions, and correct identification of the pooled standard error—accounts for the majority of free-response scoring points.

Varsity Tutors • AP Statistics • Setting Up a Test for the Difference of Two Population Proportions