Comparing Two Proportions

AP Statistics · Unit 3 — Inference for Categorical Data: Proportions

The interval

For two independent random samples, the confidence interval for $p_1-p_2$ has the usual shape, estimate $\pm$ (critical value)(standard error), with the standard error built from the two sample proportions:

$$(\hat p_1-\hat p_2)\pm z^*\sqrt{\frac{\hat p_1(1-\hat p_1)}{n_1}+\frac{\hat p_2(1-\hat p_2)}{n_2}}$$

Conditions: both samples random and independent of each other; each sample at most $10\%$ of its population; and at least $10$ successes and $10$ failures in each sample. Interpret as "we are $95\%$ confident that the difference in the true proportions ($p_1-p_2$) lies in the interval" — and say which group is subtracted from which.

The test and why it pools

The null hypothesis is $H_0:p_1=p_2$ (equivalently $p_1-p_2=0$). If the two proportions really are equal, the best estimate of that common value uses all the successes:

$$\hat p_c=\frac{X_1+X_2}{n_1+n_2},\qquad z=\frac{\hat p_1-\hat p_2}{\sqrt{\hat p_c(1-\hat p_c)\left(\frac{1}{n_1}+\frac{1}{n_2}\right)}}$$

The large-counts check for the test uses $\hat p_c$: $n_1\hat p_c$, $n_1(1-\hat p_c)$, $n_2\hat p_c$, $n_2(1-\hat p_c)$ all at least $10$. Example: $45$ of $150$ patients improve on a drug and $30$ of $150$ on a placebo. Then $\hat p_c=75/300=0{,}25$, the standard error is $\sqrt{0{,}25\cdot0{,}75\cdot(2/150)}=0{,}05$ and $z=(0{,}30-0{,}20)/0{,}05=2{,}0$.

Interval and test disagree slightly

Because the interval uses separate $\hat p$'s while the test pools, a $95\%$ interval that just barely excludes $0$ and a two-sided test at $\alpha=0{,}05$ can, rarely, give opposite verdicts. When asked, report the test for a decision and the interval for the size of the difference.

Worked example: a complete four-step two-proportion test

In a randomized experiment with $300$ patients: $150$ people took the new drug and $45$ improved; $150$ people took a placebo and $30$ improved. Is there evidence at $\alpha=0.05$ that the new drug gives a different improvement rate from the placebo?

Solution

State: $p_1,p_2$ are the true improvement rates with the drug and with the placebo. $H_0:p_1=p_2$, $H_a:p_1\ne p_2$, $\alpha=0.05$.

Check: because of random assignment the two groups are independent; $\hat p_c=\dfrac{45+30}{300}=0.25$; $150\cdot0.25=37.5$ and $150\cdot0.75=112.5$ are both $\ge10$ for both groups. Use the two-proportion $z$ test.

Calculate: $\hat p_1=0.30$, $\hat p_2=0.20$.

$$z=\frac{0.30-0.20}{\sqrt{0.25\cdot0.75\left(\frac{1}{150}+\frac{1}{150}\right)}}=\frac{0.10}{0.05}=2.0$$

Two-sided $P$-value $=2\,P(z\gt2.0)\approx0.046$.

Conclusion: since $0.046\lt0.05$, reject $H_0$. There is convincing evidence that the improvement rate with the new drug differs from that with the placebo. Because of random assignment, we may say the drug caused this difference for the patients who took part.

Common mistake

The pooled $\hat p_c$ is used only for the test; the confidence interval uses the two separate $\hat p$. If you reverse the order of subtraction ($p_2-p_1$) the sign of the interval flips with it, and you must say so clearly. The conclusion "the two proportions differ by $10\%$ in the population" is wrong: $0.10$ is the sample difference, and the true difference can be stated only through a confidence interval.

Key takeaway

Two proportions: the interval uses the two separate $\hat p$, the test pools $\hat p_c$ because $H_0$ says the two proportions are equal. Check large counts for each sample. State clearly which group is subtracted from which. Only random assignment allows a causal statement.

← Type I and Type II Errors, and Power · All AP Statistics lessons · Practice AP Statistics questions (free, instant scoring) · The Chi-Square Statistic →