Mathwords logoMathwords

Two-Proportion z-Test — Definition, Formula & Example

A two-sample z-test for the difference between two population proportions is a hypothesis test that uses data from two independent samples to decide whether two groups have different success rates. One example is whether a higher percentage of students pass with one study method than with another.

Given independent random samples of sizes n1n_1 and n2n_2 with x1x_1 and x2x_2 successes, the test evaluates H0:p1=p2H_0: p_1 = p_2 against Ha:p1≠p2H_a: p_1 \neq p_2, p1>p2p_1 > p_2, or p1<p2p_1 < p_2. It uses the test statistic z=(p^1−p^2)/SEz = (\hat{p}_1 - \hat{p}_2)/SE. Because H0H_0 assumes the proportions are equal, SESE is computed from the pooled proportion p^c\hat{p}_c. When H0H_0 is true and n1p^c, n1(1−p^c), n2p^c, n2(1−p^c)n_1\hat{p}_c,\ n_1(1-\hat{p}_c),\ n_2\hat{p}_c,\ n_2(1-\hat{p}_c) are all at least 10, zz has an approximately standard normal distribution.

Key Formula

z=p^1−p^2p^c(1−p^c)(1n1+1n2),p^c=x1+x2n1+n2z = \frac{\hat{p}_1 - \hat{p}_2}{\sqrt{\hat{p}_c\left(1 - \hat{p}_c\right)\left(\dfrac{1}{n_1} + \dfrac{1}{n_2}\right)}}, \qquad \hat{p}_c = \frac{x_1 + x_2}{n_1 + n_2}
Where:
  • p^1,p^2\hat{p}_1, \hat{p}_2 = sample proportions, x1/n1x_1/n_1 and x2/n2x_2/n_2
  • x1,x2x_1, x_2 = number of successes in each sample
  • n1,n2n_1, n_2 = sample sizes
  • p^c\hat{p}_c = pooled (combined) sample proportion
  • zz = test statistic, compared to the standard normal distribution

Worked Example

Problem: Students are randomly assigned to two study methods. With flashcards, 120 of 200 students pass. With rereading notes, 100 of 200 pass. At α=0.05\alpha = 0.05, is there convincing evidence that the pass rates differ?
Step 1: State the hypotheses H0:p1=p2H_0: p_1 = p_2 and Ha:p1≠p2H_a: p_1 \neq p_2. Then find the sample proportions and the pooled proportion. Check the conditions: 200(0.55)=110200(0.55) = 110 and 200(0.45)=90200(0.45) = 90 are both at least 10.
p^1=120200=0.60,p^2=100200=0.50,p^c=220400=0.55\hat{p}_1 = \frac{120}{200} = 0.60, \quad \hat{p}_2 = \frac{100}{200} = 0.50, \quad \hat{p}_c = \frac{220}{400} = 0.55
Step 2: Compute the standard error from the pooled proportion. Then compute zz.
SE=0.55(0.45)(1200+1200)≈0.0497,z=0.60−0.500.0497≈2.01SE = \sqrt{0.55(0.45)\left(\tfrac{1}{200} + \tfrac{1}{200}\right)} \approx 0.0497, \quad z = \frac{0.60 - 0.50}{0.0497} \approx 2.01
Step 3: The test is two-sided, so the p-value counts both tails of the standard normal curve.
p-value=2P(Z≥2.01)≈0.044\text{p-value} = 2P(Z \geq 2.01) \approx 0.044
Answer: The test gives z≈2.01z \approx 2.01 and p-value ≈0.044\approx 0.044. This is less than 0.05, so you reject H0H_0. There is convincing evidence that the pass rates for the two study methods differ.

Why It Matters

This test appears regularly on AP Statistics free-response questions. You must state hypotheses, check conditions, compute zz, and write a conclusion in context. The same calculation drives A/B testing at tech companies, such as comparing click-through rates for two web page designs. It is also used in clinical trials that compare recovery rates between a treatment group and a placebo group.

Common Mistakes

Mistake: Using the unpooled standard error p^1(1−p^1)/n1+p^2(1−p^2)/n2\sqrt{\hat{p}_1(1-\hat{p}_1)/n_1 + \hat{p}_2(1-\hat{p}_2)/n_2} in the test.
Correction: The null hypothesis assumes p1=p2p_1 = p_2, so the test combines both samples into one estimate, p^c\hat{p}_c. The unpooled standard error belongs to the two-proportion confidence interval, which does not assume the proportions are equal.

Related Terms