Skip to content
Family Table Math
Auto

Confidence Interval for a Difference in Proportions

Many real questions compare two groups. Are British Columbia adults more likely than Quebec adults to own a bike? Does a text reminder make people more likely to get a flu shot? To answer them, you estimate the difference between two population proportions. This page extends the one-sample interval to two samples or two treatment groups.

Group 1Group 2
Population proportion (unknown)p1p_1p2p_2
Sample sizen1n_1n2n_2
Sample proportionp^1\hat{p}_1p^2\hat{p}_2

The parameter is the difference p1−p2p_1 - p_2, and its point estimate is p^1−p^2\hat{p}_1 - \hat{p}_2. Always say which group is “1” and which is “2”: the sign of the difference depends on it.

The sampling distribution of the difference

Section titled “The sampling distribution of the difference”

If you took many pairs of independent random samples and calculated p^1−p^2\hat{p}_1 - \hat{p}_2 each time, the values would form the sampling distribution of p^1−p^2\hat{p}_1 - \hat{p}_2:

μp^1−p^2=p1−p2σp^1−p^2=p1(1−p1)n1+p2(1−p2)n2\mu_{\hat{p}_1 - \hat{p}_2} = p_1 - p_2 \qquad \sigma_{\hat{p}_1 - \hat{p}_2} = \sqrt{\frac{p_1(1 - p_1)}{n_1} + \frac{p_2(1 - p_2)}{n_2}}

Notice the plus sign, even though it’s a difference. For independent samples, the variabilities add: two uncertain estimates give a more uncertain difference, never a less uncertain one. (Add the variances, the squares, then take the square root. Don’t add the standard deviations.)

The distribution is approximately normal if all four expected counts, n1p1n_1p_1, n1(1−p1)n_1(1 - p_1), n2p2n_2p_2, and n2(1−p2)n_2(1 - p_2), are at least 1010.

When p1p_1 and p2p_2 are unknown, replace them with the sample proportions to get the standard error. The two-sample z-interval for a difference between population proportions is

(p^1−p^2)±z∗p^1(1−p^1)n1+p^2(1−p^2)n2(\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}}

with the same critical values z∗z^* as before (1.6451.645, 1.9601.960, 2.5762.576 for 90%90\%, 95%95\%, 99%99\%).

ConditionTwo independent random samplesA randomized experiment
RandomTwo independent random samples from the two populations.Treatments randomly assigned to the experimental units.
10%n1≤10%n_1 \le 10\% of population 1 and n2≤10%n_2 \le 10\% of population 2.Not needed (no sampling without replacement from a population).
Large CountsThe observed successes and failures in both groups (n1p^1n_1\hat{p}_1, n1(1−p^1)n_1(1 - \hat{p}_1), n2p^2n_2\hat{p}_2, n2(1−p^2)n_2(1 - \hat{p}_2)) are all at least 1010.Same.

“Independent” means the two samples don’t affect each other. Asking the same people two different questions does not give independent samples, so this procedure doesn’t apply.

We are 95%95\% confident that the interval from aa to bb captures the true difference (group 1 minus group 2) in the proportions of [population] who [response].

The confidence level means the same as before: in repeated random sampling with the same sample sizes, about 95%95\% of intervals built this way would capture the true difference p1−p2p_1 - p_2.

Look at where 00 is. A difference of 00 means p1=p2p_1 = p_2.

Three confidence intervals for p1 minus p2 on a number line, with a vertical line at 0. The first, from 0.006 to 0.174, is entirely above 0. The second, from -0.04 to 0.07, contains 0. The third, from -0.12 to -0.02, is entirely below 0. −0.10 −0.05 0 0.05 0.10 0.15 p₁ − p₂ entirely above 0: evidence that p₁ > p₂ contains 0: no convincing evidence of a difference entirely below 0: evidence that p₁ < p₂
Where 00 falls decides the conclusion. An interval that contains 00 doesn’t show the proportions are equal, only that “no difference” is plausible.
  • All values positive: convincing evidence that p1>p2p_1 \gt p_2.
  • All values negative: convincing evidence that p1<p2p_1 \lt p_2.
  • Contains 0: no convincing evidence of a difference. Equal proportions are plausible, but so are the other values in the interval.

If the data come from a randomized experiment, an interval that excludes 00 is evidence that the treatment causes a difference. With samples from two populations (an observational study), it shows a difference between the populations, not a cause.

The formula sheet gives σp^1−p^2\sigma_{\hat{p}_1 - \hat{p}_2} and SEp^1−p^2SE_{\hat{p}_1 - \hat{p}_2}. Use the same four parts as the one-sample interval: define p1−p2p_1 - p_2 in context (which minus which), name the procedure (two-sample z-interval for p1−p2p_1 - p_2), check conditions for both groups, and interpret in context. 2-PropZInt on a TI-84 checks your calculation.

Example 1: The sampling distribution of the difference

Section titled “Example 1: The sampling distribution of the difference”

In a large city, 58%58\% of downtown adults and 46%46\% of suburban adults use public transit at least once a week. A researcher takes independent random samples of 120120 downtown adults and 150150 suburban adults.

  • (a) Find the mean and standard deviation of the sampling distribution of p^D−p^S\hat{p}_D - \hat{p}_S.
  • (b) Find the probability that the downtown sample shows a lower proportion of transit users than the suburban sample.

Solution.

(a)

μp^D−p^S=0.58−0.46=0.12σp^D−p^S=0.58(0.42)120+0.46(0.54)150=0.003686=0.0607\begin{aligned} \mu_{\hat{p}_D - \hat{p}_S} &= 0.58 - 0.46 = 0.12 \\ \sigma_{\hat{p}_D - \hat{p}_S} &= \sqrt{\frac{0.58(0.42)}{120} + \frac{0.46(0.54)}{150}} = \sqrt{0.003686} = 0.0607 \end{aligned}

(b) Check the shape: 120(0.58)=69.6120(0.58) = 69.6, 120(0.42)=50.4120(0.42) = 50.4, 150(0.46)=69150(0.46) = 69, and 150(0.54)=81150(0.54) = 81 are all at least 1010, so the distribution is approximately normal. (Both samples are less than 10%10\% of large populations.)

“Downtown lower” means p^D−p^S<0\hat{p}_D - \hat{p}_S \lt 0:

P(p^D−p^S<0)=P(Z<0−0.120.0607)=P(Z<−1.98)=0.024P(\hat{p}_D - \hat{p}_S \lt 0) = P\left(Z \lt \frac{0 - 0.12}{0.0607}\right) = P(Z \lt -1.98) = 0.024

Even though downtown adults use transit more, about 2.4%2.4\% of pairs of samples would show the reverse, just by chance.

Example 2: An interval from two random samples

Section titled “Example 2: An interval from two random samples”

In independent random samples, 171171 of 300300 British Columbia adults and 120120 of 250250 Quebec adults said they had ridden a bike in the past month. Construct and interpret a 95%95\% confidence interval for the difference in the proportions. Does it give convincing evidence of a difference?

Solution.

State. pB−pQp_B - p_Q, where pBp_B and pQp_Q are the true proportions of all BC adults and all Quebec adults who rode a bike in the past month. 95%95\% confidence.

Plan. Two-sample z-interval for pB−pQp_B - p_Q.

  • Random: independent random samples from each province.
  • 10%: 300300 is less than 10%10\% of BC adults, and 250250 is less than 10%10\% of Quebec adults.
  • Large Counts: 171171, 129129, 120120, and 130130 are all at least 1010.

Do. p^B=171300=0.57\hat{p}_B = \dfrac{171}{300} = 0.57 and p^Q=120250=0.48\hat{p}_Q = \dfrac{120}{250} = 0.48.

SE=0.57(0.43)300+0.48(0.52)250=0.0426(0.57−0.48)±1.96(0.0426)=0.09±0.0835⇒(0.006, 0.174)\begin{aligned} SE &= \sqrt{\frac{0.57(0.43)}{300} + \frac{0.48(0.52)}{250}} = 0.0426 \\ (0.57 - 0.48) &\pm 1.96(0.0426) = 0.09 \pm 0.0835 \quad\Rightarrow\quad (0.006,\ 0.174) \end{aligned}

Conclude. We are 95%95\% confident that the interval from 0.0060.006 to 0.1740.174 captures the true difference (BC minus Quebec) in the proportions of adults who rode a bike in the past month. Because every value is positive, the interval gives convincing evidence that a higher proportion of BC adults than Quebec adults rode a bike. (Just barely: the lower end is close to 00.)

A clinic recruits 200200 volunteers and randomly assigns 100100 to get a text reminder about flu shots and 100100 to get no reminder. Of the reminder group, 6464 get a flu shot; of the no-reminder group, 5151 do. Construct and interpret a 90%90\% confidence interval for the difference in the proportions. What can the clinic conclude?

Solution.

State. pR−pNp_R - p_N, the true difference in the proportions of people like these volunteers who would get a flu shot with a text reminder and without one. 90%90\% confidence.

Plan. Two-sample z-interval for pR−pNp_R - p_N. Random: treatments were randomly assigned. (The 10% condition isn’t needed for an experiment.) Large Counts: 6464, 3636, 5151, and 4949 are all at least 1010.

Do. p^R=0.64\hat{p}_R = 0.64, p^N=0.51\hat{p}_N = 0.51.

SE=0.64(0.36)100+0.51(0.49)100=0.06930.13±1.645(0.0693)=0.13±0.114⇒(0.016, 0.244)\begin{aligned} SE &= \sqrt{\frac{0.64(0.36)}{100} + \frac{0.51(0.49)}{100}} = 0.0693 \\ 0.13 &\pm 1.645(0.0693) = 0.13 \pm 0.114 \quad\Rightarrow\quad (0.016,\ 0.244) \end{aligned}

Conclude. We are 90%90\% confident that the interval from 0.0160.016 to 0.2440.244 captures the true difference (reminder minus no reminder) in the proportions who would get a flu shot. The interval is entirely above 00, and the treatments were randomly assigned, so there is convincing evidence that text reminders cause an increase in flu-shot rates for people like these volunteers. Because they were volunteers, not a random sample, be careful about generalizing to everyone.

(At 95%95\% confidence the interval is (−0.006, 0.266)(-0.006,\ 0.266), which just includes 00. Higher confidence makes the evidence look weaker here.)

A student compares two large high schools. Using independent random samples, 2-PropZInt for pA−pBp_A - p_B (the proportions of students who bring a reusable water bottle to school) gives the 95%95\% interval (−0.040, 0.070)(-0.040,\ 0.070).

  • (a) Find the point estimate and margin of error.
  • (b) Interpret the interval. Is there convincing evidence of a difference?
  • (c) A friend says, “So the two schools have the same proportion.” Respond.

Solution.

(a) Point estimate: the midpoint, −0.040+0.0702=0.015\dfrac{-0.040 + 0.070}{2} = 0.015. Margin of error: half the width, 0.070−(−0.040)2=0.055\dfrac{0.070 - (-0.040)}{2} = 0.055.

(b) We are 95%95\% confident that the interval from −0.040-0.040 to 0.0700.070 captures the true difference (School A minus School B) in the proportions of students who bring a reusable bottle. Because the interval contains 00, there is no convincing evidence that the proportions differ.

(c) Not necessarily. 00 is plausible, but so is everything from School A being 44 points lower to 77 points higher. Failing to find a difference isn’t the same as showing there’s none.

Subtracting in the standard error. It’s always p1(1−p1)n1+p2(1−p2)n2\dfrac{p_1(1 - p_1)}{n_1} \mathbin{\boldsymbol{+}} \dfrac{p_2(1 - p_2)}{n_2} under the square root. Variability adds, even for a difference.

Adding the two standard errors. a+b\sqrt{a + b} is not a+b\sqrt{a} + \sqrt{b}. Add the two fractions first, then take one square root.

Not saying which minus which. An interval of (0.02, 0.11)(0.02,\ 0.11) means something completely different for p1−p2p_1 - p_2 than for p2−p1p_2 - p_1. Define the parameter clearly and interpret the sign.

Treating “contains 0” as proof of no difference. It only means a difference of 00 is plausible. Many non-zero differences are plausible too.

Using two-sample methods on paired data. If the same people answer two questions, or each person is matched with another, the samples aren’t independent. This interval would be wrong.

Claiming cause and effect from two samples. Only a randomized experiment supports “the treatment causes the difference”. Two random samples from two populations show an association.

1. (Warm-up) In independent random samples, 4545 of 150150 Grade 11 students and 3030 of 120120 Grade 12 students at a large school board said they have a library card. Define the parameter and find the point estimate.

Solution

The parameter is p11−p12p_{11} - p_{12}, the difference in the true proportions of all Grade 11 and all Grade 12 students in the board who have a library card. The point estimate is p^11−p^12=45150−30120=0.30−0.25=0.05\hat{p}_{11} - \hat{p}_{12} = \dfrac{45}{150} - \dfrac{30}{120} = 0.30 - 0.25 = 0.05.

2. (Warm-up) For the data in Question 1, find the standard error and a 95%95\% confidence interval for p11−p12p_{11} - p_{12}. (Assume the conditions are met.)

SolutionSE=0.30(0.70)150+0.25(0.75)120=0.0014+0.0015625=0.0544SE = \sqrt{\frac{0.30(0.70)}{150} + \frac{0.25(0.75)}{120}} = \sqrt{0.0014 + 0.0015625} = 0.05440.05±1.96(0.0544)=0.05±0.107⇒(−0.057, 0.157)0.05 \pm 1.96(0.0544) = 0.05 \pm 0.107 \quad\Rightarrow\quad (-0.057,\ 0.157)

3. (Warm-up) A 95%95\% confidence interval for pM−pWp_M - p_W, the difference in the proportions of men and women in a province who listen to podcasts weekly, is (0.03, 0.11)(0.03,\ 0.11). Interpret it, and say what it suggests about the two proportions.

Solution

We are 95%95\% confident that the interval from 0.030.03 to 0.110.11 captures the true difference (men minus women) in the proportions who listen to podcasts weekly. All values are positive, so it gives convincing evidence that a higher proportion of men than women in the province listen to podcasts weekly, by between 33 and 1111 percentage points.

4. (Core) An outdoor-gear company surveys independent random samples of its customers in two regions. In the Prairies, 126126 of 280280 customers bought winter boots this year; in Atlantic Canada, 9696 of 300300 did. Construct and interpret a 95%95\% confidence interval for the difference in the proportions.

Solution

State. pP−pAp_P - p_A: the true difference in the proportions of all the company’s Prairie and Atlantic customers who bought winter boots this year. 95%95\% confidence.

Plan. Two-sample z-interval for pP−pAp_P - p_A. Independent random samples; each sample is less than 10%10\% of the company’s customers in that region (assuming each region has more than 30003000 customers); successes and failures 126126, 154154, 9696, 204204 are all at least 1010.

Do. p^P=0.45\hat{p}_P = 0.45, p^A=0.32\hat{p}_A = 0.32.

SE=0.45(0.55)280+0.32(0.68)300=0.04010.13±1.96(0.0401)=0.13±0.079⇒(0.051, 0.209)\begin{aligned} SE &= \sqrt{\frac{0.45(0.55)}{280} + \frac{0.32(0.68)}{300}} = 0.0401 \\ 0.13 &\pm 1.96(0.0401) = 0.13 \pm 0.079 \quad\Rightarrow\quad (0.051,\ 0.209) \end{aligned}

Conclude. We are 95%95\% confident that the interval from 0.0510.051 to 0.2090.209 captures the true difference (Prairies minus Atlantic) in the proportions of customers who bought winter boots this year. Because all the values are positive, there is convincing evidence that a higher proportion of Prairie customers bought boots.

5. (Core) At a large university, 35%35\% of first-year students and 25%25\% of fourth-year students live in residence. Independent random samples of 200200 first-year and 250250 fourth-year students are taken.

  • (a) Find the mean and standard deviation of p^1−p^4\hat{p}_1 - \hat{p}_4.
  • (b) Find the probability that the fourth-year sample has a higher proportion living in residence than the first-year sample.
Solution

(a) μ=0.35−0.25=0.10\mu = 0.35 - 0.25 = 0.10 and

σ=0.35(0.65)200+0.25(0.75)250=0.0434\sigma = \sqrt{\frac{0.35(0.65)}{200} + \frac{0.25(0.75)}{250}} = 0.0434

(b) Large Counts: 7070, 130130, 62.562.5, and 187.5187.5 are all at least 1010, so the distribution is approximately normal.

P(p^1−p^4<0)=P(Z<0−0.100.0434)=P(Z<−2.30)=0.0107P(\hat{p}_1 - \hat{p}_4 \lt 0) = P\left(Z \lt \frac{0 - 0.10}{0.0434}\right) = P(Z \lt -2.30) = 0.0107

6. (Core) A researcher wants a 95%95\% interval for the difference between the proportions of two small towns’ residents who own a boat. In a random sample of 5050 residents of Town A, 88 own a boat; in a random sample of 6060 residents of Town B, 2121 do. Which condition fails? Why does it matter?

Solution

Large Counts fails: Town A has only 88 successes, which is less than 1010. (The other counts, 4242, 2121, and 3939, are fine.) With so few successes, the sampling distribution of p^A−p^B\hat{p}_A - \hat{p}_B may not be approximately normal, so the z∗z^* interval and its 95%95\% confidence level may not be accurate. (The 10% condition should also be checked: each town would need at least 500500 and 600600 residents.)

7. (Core) A company randomly assigns 300300 new users of its app to one of two sign-up screens, 150150 each. With the new screen, 7878 users finish signing up; with the old screen, 5757 do. Construct and interpret a 99%99\% confidence interval for the difference in the proportions who finish (new minus old). Does it show that the new screen works better?

Solution

Random assignment; the 10% condition isn’t needed; 7878, 7272, 5757, and 9393 are all at least 1010.

p^N=0.52\hat{p}_N = 0.52, p^O=0.38\hat{p}_O = 0.38.

SE=0.52(0.48)150+0.38(0.62)150=0.05690.14±2.576(0.0569)=0.14±0.147⇒(−0.007, 0.287)\begin{aligned} SE &= \sqrt{\frac{0.52(0.48)}{150} + \frac{0.38(0.62)}{150}} = 0.0569 \\ 0.14 &\pm 2.576(0.0569) = 0.14 \pm 0.147 \quad\Rightarrow\quad (-0.007,\ 0.287) \end{aligned}

We are 99%99\% confident that the interval from −0.007-0.007 to 0.2870.287 captures the true difference (new minus old) in the proportions of users like these who would finish signing up. The interval contains 00 (just), so at 99%99\% confidence there is not convincing evidence that the new screen works better, although most of the plausible values favour it.

8. (Challenge) A 95%95\% confidence interval for p1−p2p_1 - p_2 is (−0.02, 0.10)(-0.02,\ 0.10).

  • (a) Find the standard error.
  • (b) Find the 90%90\% confidence interval from the same data. Does it contain 00?
Solution

(a) The point estimate is 0.040.04 and the margin of error is 0.060.06, so SE=0.061.96=0.0306SE = \dfrac{0.06}{1.96} = 0.0306.

(b) 0.04±1.645(0.0306)=0.04±0.05040.04 \pm 1.645(0.0306) = 0.04 \pm 0.0504, which gives (−0.010, 0.090)(-0.010,\ 0.090). It still contains 00, so even at 90%90\% confidence there’s no convincing evidence of a difference.

9. (Challenge) A researcher wants to estimate p1−p2p_1 - p_2 to within 0.050.05 with 95%95\% confidence, using two samples of the same size nn. With no prior estimates, how large should nn be?

Solution

Use p^1=p^2=0.5\hat{p}_1 = \hat{p}_2 = 0.5, the worst case:

1.960.25n+0.25n≤0.05⇒n≥(1.960.05)2(0.5)=768.31.96\sqrt{\frac{0.25}{n} + \frac{0.25}{n}} \le 0.05 \quad\Rightarrow\quad n \ge \left(\frac{1.96}{0.05}\right)^2 (0.5) = 768.3

So n=769n = 769 in each group. That’s about twice what one proportion needs for the same margin of error, because two estimates bring two sources of variability.

Try these independently after the practice questions. Show your setup and explain your reasoning. Check every condition with numbers and in context, for both groups, and interpret your answers in context. Homework solutions are not provided on the published site.

All data in these questions are hypothetical.

H1. (Foundations) For each study, say whether a two-sample z-interval for p1−p2p_1 - p_2 is appropriate. Explain.

  • (a) A random sample of 200200 Winnipeg households and a separate random sample of 200200 Regina households are asked whether they have a backyard garden.
  • (b) A random sample of 300300 students is asked whether they own a laptop and whether they own a tablet, to compare the two proportions.
  • (c) 8080 volunteers are randomly assigned to two study methods, and the proportion who pass a test is recorded for each group.

H2. (Foundations) In a large province, 62%62\% of urban households and 55%55\% of rural households have high-speed internet. Independent random samples of 200200 urban and 180180 rural households are taken. Find the mean and standard deviation of p^U−p^R\hat{p}_U - \hat{p}_R, and check that its sampling distribution is approximately normal.

H3. (Core) In independent random samples, 236236 of 400400 Ontario homeowners and 168168 of 350350 Alberta homeowners said they had made an energy-saving upgrade in the past five years. Construct a 95%95\% confidence interval for the difference in the proportions (Ontario minus Alberta).

H4. (Core) For your interval in H3:

  • (a) Interpret the interval in context.
  • (b) Interpret the confidence level.
  • (c) Does the interval give convincing evidence that the proportions differ? Can you conclude that something about Ontario causes more upgrades? Explain.

H5. (Core) Two large towns each have 30%30\% of residents who volunteer. Independent random samples of 200200 residents are taken from each town. Find the probability that the two sample proportions differ by more than 0.100.10 in favour of the first town (that is, p^1−p^2>0.10\hat{p}_1 - \hat{p}_2 \gt 0.10).

H6. (Core) A fitness app randomly assigns 480480 new users to two onboarding styles. Of the 240240 who get a personalized plan, 132132 are still active after a month; of the 240240 who get the standard plan, 108108 are. Construct and interpret a 90%90\% confidence interval for the difference in the proportions (personalized minus standard). What can the company conclude?

H7. (Challenge) A report gives a 95%95\% confidence interval of (−0.12, −0.02)(-0.12,\ -0.02) for pA−pBp_A - p_B, the difference in the proportions of two companies’ employees who work from home at least one day a week.

  • (a) Find the point estimate and margin of error.
  • (b) Give the interval for pB−pAp_B - p_A.
  • (c) Interpret the interval for pB−pAp_B - p_A and state what it shows.

H8. (Challenge) A teacher asks a random sample of 150150 students two questions: “Do you play a sport?” (6363 yes) and “Do you play an instrument?” (4848 yes). She computes a two-sample z-interval for psport−pinstrumentp_{\text{sport}} - p_{\text{instrument}}.

  • (a) Explain why the two-sample interval is not appropriate.
  • (b) Describe how she could design a study for which it would be appropriate.

H9. (Challenge) A researcher wants to estimate the difference between two proportions to within 0.040.04 with 95%95\% confidence, using samples of equal size nn. Earlier studies suggest p1≈0.3p_1 \approx 0.3 and p2≈0.2p_2 \approx 0.2. How large should each sample be? Compare with the size needed if she used 0.50.5 for both.

H10. (Challenge) Two populations have the same proportion, p1=p2=0.5p_1 = p_2 = 0.5. Independent random samples of the same size nn are taken from each.

  • (a) Show that σp^1−p^2=0.5n\sigma_{\hat{p}_1 - \hat{p}_2} = \sqrt{\dfrac{0.5}{n}}.
  • (b) Find the smallest nn for which P(∣p^1−p^2∣≥0.10)≤0.05P(\lvert \hat{p}_1 - \hat{p}_2 \rvert \ge 0.10) \le 0.05.
  • (c) Explain what your answer says about seeing a 1010-point gap between two samples when the populations are actually identical.