Skip to content
Family Table Math
Auto

Significance Test for a Difference in Proportions

Does a new study method raise pass rates? Are Ontario students more likely than BC students to take a gap year? A confidence interval for a difference estimates how big a difference is. A two-sample z-test asks a sharper question: is the difference in the samples big enough to be convincing evidence of a real difference, or could chance alone explain it? The steps are the same as the one-sample test, with one new idea: the pooled proportion.

The null hypothesis says there is no difference between the two population (or treatment) proportions:

H0:p1=p2(or p1−p2=0)H_0: p_1 = p_2 \quad (\text{or } p_1 - p_2 = 0)

The alternative is one of

Ha:p1>p2Ha:p1<p2Ha:p1≠p2H_a: p_1 \gt p_2 \qquad H_a: p_1 \lt p_2 \qquad H_a: p_1 \ne p_2

Define both parameters in context, and say which group is which. In AP Statistics, the null hypothesis for this test is always “no difference”.

A test calculates everything assuming H0H_0 is true. If p1=p2p_1 = p_2, the two groups have one common proportion, and the best estimate of it combines both samples:

p^c=x1+x2n1+n2=total successestotal observations\hat{p}_c = \frac{x_1 + x_2}{n_1 + n_2} = \frac{\text{total successes}}{\text{total observations}}

This is the pooled (or combined) proportion. You can also find it as p^c=n1p^1+n2p^2n1+n2\hat{p}_c = \dfrac{n_1\hat{p}_1 + n_2\hat{p}_2}{n_1 + n_2}.

Using p^c\hat{p}_c for both groups in the standard error gives the two-sample z-test for a difference between population proportions:

z=p^1−p^2p^c(1−p^c)(1n1+1n2)z = \frac{\hat{p}_1 - \hat{p}_2}{\sqrt{\hat{p}_c(1 - \hat{p}_c)\left(\dfrac{1}{n_1} + \dfrac{1}{n_2}\right)}}

The numerator is (statistic −- parameter) with the parameter p1−p2=0p_1 - p_2 = 0 from H0H_0. If H0H_0 is true, zz has approximately a standard normal distribution, so the p-value comes from the normal table or 2-PropZTest, exactly as in the one-sample test.

Pooled for the test, unpooled for the interval

Section titled “Pooled for the test, unpooled for the interval”
Test of H0:p1=p2H_0: p_1 = p_2Confidence interval for p1−p2p_1 - p_2
Assumesp1=p2p_1 = p_2nothing about p1p_1 and p2p_2
Standard errorp^c(1−p^c)(1n1+1n2)\sqrt{\hat{p}_c(1 - \hat{p}_c)\left(\dfrac{1}{n_1} + \dfrac{1}{n_2}\right)} (pooled)p^1(1−p^1)n1+p^2(1−p^2)n2\sqrt{\dfrac{\hat{p}_1(1 - \hat{p}_1)}{n_1} + \dfrac{\hat{p}_2(1 - \hat{p}_2)}{n_2}} (unpooled)
Large Counts usesn1p^cn_1\hat{p}_c, n1(1−p^c)n_1(1 - \hat{p}_c), n2p^cn_2\hat{p}_c, n2(1−p^c)n_2(1 - \hat{p}_c)the observed successes and failures

Both are on the formula sheet. Use the test to decide whether there’s a difference; use the interval to estimate how big it is. Usually they agree, but they use different standard errors, so they can disagree in borderline cases.

  • Random: two independent random samples, or a randomized experiment (treatments randomly assigned).
  • 10%: for random samples, n1≤10%n_1 \le 10\% of population 1 and n2≤10%n_2 \le 10\% of population 2. Not needed for an experiment.
  • Large Counts: n1p^cn_1\hat{p}_c, n1(1−p^c)n_1(1 - \hat{p}_c), n2p^cn_2\hat{p}_c, and n2(1−p^c)n_2(1 - \hat{p}_c) are all at least 1010.

Assuming there is no difference between [the two proportions, in context], there is a [p-value] probability of getting a difference in sample proportions of [p^1−p^2\hat{p}_1 - \hat{p}_2] or [more extreme, in the direction of HaH_a] by chance alone.

For an experiment, “by chance alone” means by the random assignment alone.

How the data were produced decides what a significant result means:

Treatments randomly assignedNot randomly assigned
Random sample from the populationCause and effect, for the whole populationA difference (association) in the populations, not cause
Not a random sampleCause and effect, but only for units like those in the studyOnly a difference in these particular groups

A randomized experiment on volunteers can show that a treatment causes a difference, but only for people like the volunteers. Two random samples from two populations let you generalize to those populations, but they can’t rule out other explanations (confounding variables).

Use the same four parts as every test: hypotheses with both parameters defined in context; the procedure name (two-sample z-test for p1−p2p_1 - p_2) and conditions with the pooled counts; the test statistic and p-value; and a conclusion in context, in terms of HaH_a. If the question asks, add what the design lets you conclude (cause? which population?). The p-values on this page come from technology using the unrounded test statistic, so the normal table can differ slightly in the last digit.

Define the parameters and write the hypotheses.

  • (a) A researcher wonders whether the proportion of Grade 12 students planning a gap year is different in Ontario and British Columbia.
  • (b) A teacher wants to know whether retrieval practice (self-quizzing) leads to a higher pass rate than rereading notes.

Solution.

(a) pOp_O and pBp_B are the true proportions of all Grade 12 students in Ontario and in BC who plan to take a gap year. H0:pO=pBH_0: p_O = p_B, Ha:pO≠pBH_a: p_O \ne p_B.

(b) pRp_R and pNp_N are the true proportions of students like these who would pass using retrieval practice and using rereading. H0:pR=pNH_0: p_R = p_N, Ha:pR>pNH_a: p_R \gt p_N.

In independent random samples, 9595 of 250250 Ontario Grade 12 students and 6666 of 220220 BC Grade 12 students said they plan to take a gap year. At α=0.05\alpha = 0.05, do the data give convincing evidence that the proportions differ?

Solution.

State. Hypotheses as in Example 1(a), with α=0.05\alpha = 0.05.

Plan. Two-sample z-test for pO−pBp_O - p_B.

  • Random: independent random samples of students from each province.
  • 10%: 250250 and 220220 are less than 10%10\% of Grade 12 students in each province.
  • Large Counts: p^c=95+66250+220=161470=0.3426\hat{p}_c = \dfrac{95 + 66}{250 + 220} = \dfrac{161}{470} = 0.3426. Then 250(0.3426)=85.6250(0.3426) = 85.6, 250(0.6574)=164.4250(0.6574) = 164.4, 220(0.3426)=75.4220(0.3426) = 75.4, and 220(0.6574)=144.6220(0.6574) = 144.6 are all at least 1010.

Do. p^O=95250=0.38\hat{p}_O = \dfrac{95}{250} = 0.38 and p^B=66220=0.30\hat{p}_B = \dfrac{66}{220} = 0.30.

z=0.38−0.300.3426(0.6574)(1250+1220)=0.080.0439=1.82p-value=2P(Z≥1.82)=0.068\begin{aligned} z &= \frac{0.38 - 0.30}{\sqrt{0.3426(0.6574)\left(\dfrac{1}{250} + \dfrac{1}{220}\right)}} = \frac{0.08}{0.0439} = 1.82 \\ \text{p-value} &= 2P(Z \ge 1.82) = 0.068 \end{aligned}

Conclude. Because the p-value of 0.0680.068 is greater than α=0.05\alpha = 0.05, we fail to reject H0H_0. There is not convincing evidence that the proportion of Grade 12 students planning a gap year is different in Ontario and BC.

(The 95%95\% interval for pO−pBp_O - p_B is (−0.005, 0.165)(-0.005,\ 0.165), which contains 00, agreeing with the test.)

A teacher randomly assigns 120120 student volunteers to two groups of 6060. One group studies by retrieval practice and the other by rereading. On the unit test, 4747 of the retrieval group and 3636 of the rereading group pass. Do the data give convincing evidence at α=0.05\alpha = 0.05 that retrieval practice leads to a higher pass rate?

Solution.

State. Hypotheses as in Example 1(b), with α=0.05\alpha = 0.05.

Plan. Two-sample z-test for pR−pNp_R - p_N. Random: the study methods were randomly assigned. (The 10% condition isn’t needed for an experiment.) Large Counts: p^c=47+36120=83120=0.6917\hat{p}_c = \dfrac{47 + 36}{120} = \dfrac{83}{120} = 0.6917, and 60(0.6917)=41.560(0.6917) = 41.5 and 60(0.3083)=18.560(0.3083) = 18.5 are at least 1010 for both groups.

Do. p^R=4760=0.783\hat{p}_R = \dfrac{47}{60} = 0.783 and p^N=3660=0.600\hat{p}_N = \dfrac{36}{60} = 0.600.

z=0.783−0.6000.6917(0.3083)(160+160)=0.1830.0843=2.17p-value=P(Z≥2.17)=0.0148\begin{aligned} z &= \frac{0.783 - 0.600}{\sqrt{0.6917(0.3083)\left(\dfrac{1}{60} + \dfrac{1}{60}\right)}} = \frac{0.183}{0.0843} = 2.17 \\ \text{p-value} &= P(Z \ge 2.17) = 0.0148 \end{aligned}

Conclude. Because 0.0148<0.050.0148 \lt 0.05, we reject H0H_0. There is convincing evidence that retrieval practice leads to a higher pass rate than rereading. Because the methods were randomly assigned, this is evidence that retrieval practice causes the higher pass rate, for students like these volunteers.

Interpret the p-value from Example 3.

Solution. Assuming that retrieval practice and rereading have the same pass rate, there is a 0.01480.0148 probability of getting a difference in pass rates of 0.1830.183 or higher (retrieval minus rereading) by the random assignment alone.

Not pooling in the test. A test assumes H0H_0: p1=p2p_1 = p_2, so it uses one combined estimate p^c\hat{p}_c in the standard error and in Large Counts. (The interval does the opposite: it doesn’t pool.)

Averaging the two sample proportions to pool. p^c\hat{p}_c is total successes over total observations. That only equals p^1+p^22\dfrac{\hat{p}_1 + \hat{p}_2}{2} when n1=n2n_1 = n_2.

Writing hypotheses about p̂₁ and p̂₂. You know the sample proportions; the hypotheses are about the population (or true treatment) proportions p1p_1 and p2p_2.

Claiming cause and effect without random assignment. Two random samples from two populations show a difference between the populations. Only a randomized experiment supports “causes”.

Generalizing an experiment to everyone. Random assignment doesn’t make volunteers representative. Conclusions apply to units like those in the study.

Getting the direction of Hₐ wrong. If you define the difference as p1−p2p_1 - p_2 and the claim is that group 2 is higher, HaH_a is p1<p2p_1 \lt p_2. Keep the order the same throughout.

1. (Warm-up) Define the parameters and write the hypotheses: a city wants to know whether a smaller proportion of drivers speed in school zones with flashing signs than in school zones with ordinary signs.

Solution

pFp_F and pOp_O are the true proportions of all drivers who speed in school zones with flashing signs and with ordinary signs. H0:pF=pOH_0: p_F = p_O, Ha:pF<pOH_a: p_F \lt p_O.

2. (Warm-up) In independent random samples, 4242 of 120120 customers at Store A and 3030 of 100100 customers at Store B used a coupon. Find the pooled proportion, check the Large Counts condition for a test, and find the test statistic for Ha:pA≠pBH_a: p_A \ne p_B.

Solution

p^c=42+30120+100=72220=0.327\hat{p}_c = \dfrac{42 + 30}{120 + 100} = \dfrac{72}{220} = 0.327.

Large Counts: 120(0.327)=39.3120(0.327) = 39.3, 120(0.673)=80.7120(0.673) = 80.7, 100(0.327)=32.7100(0.327) = 32.7, and 100(0.673)=67.3100(0.673) = 67.3 are all at least 1010.

p^A=0.35\hat{p}_A = 0.35 and p^B=0.30\hat{p}_B = 0.30:

z=0.35−0.300.327(0.673)(1120+1100)=0.050.0635=0.79z = \frac{0.35 - 0.30}{\sqrt{0.327(0.673)\left(\dfrac{1}{120} + \dfrac{1}{100}\right)}} = \frac{0.05}{0.0635} = 0.79

3. (Warm-up) A two-sample z-test gives z=1.38z = 1.38. Find the p-value for (a) Ha:p1>p2H_a: p_1 \gt p_2, (b) Ha:p1<p2H_a: p_1 \lt p_2, and (c) Ha:p1≠p2H_a: p_1 \ne p_2.

Solution

(a) P(Z≥1.38)=0.0838P(Z \ge 1.38) = 0.0838.

(b) P(Z≤1.38)=0.9162P(Z \le 1.38) = 0.9162.

(c) 2P(Z≥1.38)=0.1682P(Z \ge 1.38) = 0.168.

4. (Core) A pollster takes independent random samples of 300300 adults in Calgary and 300300 in Edmonton. In Calgary, 117117 say they support a new arena tax; in Edmonton, 141141 do. At α=0.05\alpha = 0.05, is there convincing evidence that the proportions differ?

Solution

State. pCp_C and pEp_E: the true proportions of all Calgary and all Edmonton adults who support the arena tax. H0:pC=pEH_0: p_C = p_E, Ha:pC≠pEH_a: p_C \ne p_E, α=0.05\alpha = 0.05.

Plan. Two-sample z-test for pC−pEp_C - p_E. Independent random samples; each sample is less than 10%10\% of the city’s adults; p^c=258600=0.43\hat{p}_c = \dfrac{258}{600} = 0.43, and 300(0.43)=129300(0.43) = 129 and 300(0.57)=171300(0.57) = 171 are at least 1010 for both cities.

Do. p^C=0.39\hat{p}_C = 0.39, p^E=0.47\hat{p}_E = 0.47.

z=0.39−0.470.43(0.57)(1300+1300)=−0.080.0404=−1.98p-value=2P(Z≤−1.98)=0.0478\begin{aligned} z &= \frac{0.39 - 0.47}{\sqrt{0.43(0.57)\left(\dfrac{1}{300} + \dfrac{1}{300}\right)}} = \frac{-0.08}{0.0404} = -1.98 \\ \text{p-value} &= 2P(Z \le -1.98) = 0.0478 \end{aligned}

Conclude. Because 0.0478<0.050.0478 \lt 0.05, reject H0H_0. There is convincing evidence that the proportion of adults who support the arena tax is different in Calgary and Edmonton.

5. (Core) A hospital randomly assigns 180180 patients recovering from knee surgery to two physiotherapy programs, 9090 each. After six weeks, 5151 patients in the new program and 3636 in the standard program can climb stairs without pain. Do the data give convincing evidence at α=0.05\alpha = 0.05 that the new program works better?

Solution

State. pNp_N and pSp_S: the true proportions of patients like these who could climb stairs without pain after six weeks with the new program and with the standard program. H0:pN=pSH_0: p_N = p_S, Ha:pN>pSH_a: p_N \gt p_S, α=0.05\alpha = 0.05.

Plan. Two-sample z-test for pN−pSp_N - p_S. Random assignment; p^c=87180=0.483\hat{p}_c = \dfrac{87}{180} = 0.483, and 90(0.483)=43.590(0.483) = 43.5 and 90(0.517)=46.590(0.517) = 46.5 are at least 1010 for both groups.

Do. p^N=5190=0.567\hat{p}_N = \dfrac{51}{90} = 0.567, p^S=3690=0.400\hat{p}_S = \dfrac{36}{90} = 0.400.

z=0.567−0.4000.483(0.517)(190+190)=0.1670.0745=2.24p-value=P(Z≥2.24)=0.0126\begin{aligned} z &= \frac{0.567 - 0.400}{\sqrt{0.483(0.517)\left(\dfrac{1}{90} + \dfrac{1}{90}\right)}} = \frac{0.167}{0.0745} = 2.24 \\ \text{p-value} &= P(Z \ge 2.24) = 0.0126 \end{aligned}

Conclude. Because 0.0126<0.050.0126 \lt 0.05, reject H0H_0. There is convincing evidence that the new program leads to a higher proportion of patients climbing stairs without pain after six weeks. Since the programs were randomly assigned, the new program appears to cause the improvement, for patients like these.

6. (Core) For the study in Question 5:

  • (a) Interpret the p-value in context.
  • (b) Which type of error might the hospital have made? Describe it in context.
Solution

(a) Assuming the two programs have the same success rate, there is a 0.01260.0126 probability of getting a difference in sample proportions (new minus standard) of 0.1670.167 or more by the random assignment alone.

(b) The hospital rejected H0H_0, so a Type I error is possible: concluding that the new program works better when in fact the two programs have the same success rate.

7. (Core) For each design, say whether a significant result would support (i) cause and effect and (ii) generalizing to a larger population.

  • (a) A random sample of 500500 Canadian teens is surveyed; those who play a team sport are compared with those who don’t on whether they report high stress.
  • (b) 200200 volunteers are randomly assigned to two diets.
  • (c) A random sample of 400400 adults is selected, and each is randomly assigned to one of two exercise plans.
Solution

(a) (i) No: team sport wasn’t assigned, so other variables could explain a difference. (ii) Yes: to Canadian teens, because it’s a random sample.

(b) (i) Yes: random assignment. (ii) No: volunteers aren’t a random sample, so only to people like these volunteers.

(c) (i) Yes: random assignment. (ii) Yes: to the population the adults were sampled from.

8. (Challenge) In independent random samples, 8484 of 200200 Grade 9 students and 6262 of 200200 Grade 12 students at a large board said they read for fun every week.

  • (a) Test at α=0.05\alpha = 0.05 whether the proportions differ.
  • (b) Construct a 95%95\% confidence interval for p9−p12p_9 - p_{12}.
  • (c) Explain why (a) and (b) use different standard errors, and whether they agree here.
Solution

(a) p^9=0.42\hat{p}_9 = 0.42, p^12=0.31\hat{p}_{12} = 0.31, p^c=146400=0.365\hat{p}_c = \dfrac{146}{400} = 0.365. Large Counts: 200(0.365)=73200(0.365) = 73 and 200(0.635)=127200(0.635) = 127 for both groups. (Random samples; each is less than 10%10\% of a large board’s students in that grade.)

z=0.42−0.310.365(0.635)(2200)=0.110.0481=2.28p-value=2P(Z≥2.28)=0.0223z = \frac{0.42 - 0.31}{\sqrt{0.365(0.635)\left(\dfrac{2}{200}\right)}} = \frac{0.11}{0.0481} = 2.28 \qquad \text{p-value} = 2P(Z \ge 2.28) = 0.0223

Since 0.0223<0.050.0223 \lt 0.05, reject H0H_0: there is convincing evidence that the proportions of Grade 9 and Grade 12 students who read for fun weekly are different.

(b)

0.11±1.960.42(0.58)200+0.31(0.69)200=0.11±1.96(0.0478)=0.11±0.094⇒(0.016, 0.204)\begin{aligned} &0.11 \pm 1.96\sqrt{\frac{0.42(0.58)}{200} + \frac{0.31(0.69)}{200}} \\ &= 0.11 \pm 1.96(0.0478) = 0.11 \pm 0.094 \quad\Rightarrow\quad (0.016,\ 0.204) \end{aligned}

(c) The test assumes p9=p12p_9 = p_{12}, so it pools the samples; the interval makes no such assumption, so it uses each sample’s own proportion. They agree here: the test rejects “no difference”, and the interval doesn’t contain 00.

9. (Challenge) Two groups of the same size nn have p^1=0.30\hat{p}_1 = 0.30 and p^2=0.25\hat{p}_2 = 0.25. Find the smallest nn for which a test of H0:p1=p2H_0: p_1 = p_2 against Ha:p1>p2H_a: p_1 \gt p_2 would be significant at α=0.05\alpha = 0.05.

Solution

With equal sizes, p^c=0.30+0.252=0.275\hat{p}_c = \dfrac{0.30 + 0.25}{2} = 0.275. Reject when z≥1.645z \ge 1.645:

0.050.275(0.725)(2n)≥1.645n≥1.6450.398750.05=20.78n≥431.6\begin{aligned} \frac{0.05}{\sqrt{0.275(0.725)\left(\dfrac{2}{n}\right)}} &\ge 1.645 \\ \sqrt{n} &\ge \frac{1.645\sqrt{0.39875}}{0.05} = 20.78 \\ n &\ge 431.6 \end{aligned}

So n=432n = 432 in each group. (Check: n=432n = 432 gives z=1.6457z = 1.6457; n=431n = 431 gives z=1.6438z = 1.6438.)

Try these independently after the practice questions. Show your setup and explain your reasoning. Check every condition with numbers and in context, and write every conclusion in context in terms of the alternative hypothesis. Homework solutions are not provided on the published site.

All data in these questions are hypothetical.

H1. (Foundations) Define the parameters and write the hypotheses. Also say whether the study is an experiment or uses samples from two populations.

  • (a) A nutrition researcher randomly assigns volunteers to a high-fibre or a regular breakfast and records whether each is still hungry two hours later. She thinks fewer people will be hungry after the high-fibre breakfast.
  • (b) A survey compares the proportions of Nunavut and Yukon adults who hunt or fish for food, to see whether they differ.

H2. (Foundations) In independent random samples, 5454 of 180180 Halifax adults and 3939 of 200200 Moncton adults said they had taken a ferry in the past year. For a test of Ha:pH>pMH_a: p_H \gt p_M:

  • (a) Find the pooled proportion and check Large Counts.
  • (b) Find the test statistic and the p-value.

H3. (Core) In independent random samples, 132132 of 400400 Manitoba students and 9999 of 375375 Saskatchewan students said they walk or bike to school. At α=0.05\alpha = 0.05, is there convincing evidence that a higher proportion of Manitoba students walk or bike to school?

H4. (Core) A language-learning company randomly assigns 160160 new users to two versions of its first lesson, 8080 each. With a game-based lesson, 3737 users complete the course; with a video lesson, 4949 do. At α=0.05\alpha = 0.05, is there convincing evidence that the completion rates differ?

H5. (Core) For your test in H3:

  • (a) Interpret the p-value in context.
  • (b) Can you conclude that living in Manitoba causes students to walk or bike more? Explain.

H6. (Core) A student compared the proportions of urban and rural teens with a part-time job, using independent random samples of 150150 each: 6060 urban and 4545 rural teens had a job. Here is part of her write-up:

H0:p^U=p^RH_0: \hat{p}_U = \hat{p}_R, Ha:p^U>p^RH_a: \hat{p}_U \gt \hat{p}_R.

SE=0.4(0.6)150+0.3(0.7)150SE = \sqrt{\dfrac{0.4(0.6)}{150} + \dfrac{0.3(0.7)}{150}}, so z=1.83z = 1.83 and p-value =0.034= 0.034.

Since 0.034<0.050.034 \lt 0.05, living in a city causes teens to be more likely to get a job.

  • (a) Identify three errors.
  • (b) Carry out the test correctly at α=0.05\alpha = 0.05 and write a correct conclusion.

H7. (Challenge) A calculator’s 2-PropZTest output for Ha:p1>p2H_a: p_1 \gt p_2 shows p^1=0.42\hat{p}_1 = 0.42, p^2=0.35\hat{p}_2 = 0.35, pooled p^=0.385\hat{p} = 0.385, and z=1.76z = 1.76. The two samples were the same size.

  • (a) Find the sample size nn of each group (to the nearest whole number).
  • (b) Find the p-value, and state the conclusion at α=0.05\alpha = 0.05.

H8. (Challenge) Two equal-sized groups have p^1=0.62\hat{p}_1 = 0.62 and p^2=0.55\hat{p}_2 = 0.55. Find the smallest group size nn for which a test of H0:p1=p2H_0: p_1 = p_2 against Ha:p1>p2H_a: p_1 \gt p_2 is significant at α=0.05\alpha = 0.05.

H9. (Challenge) A two-sided two-sample z-test gives a p-value of 0.080.08.

  • (a) Would a 95%95\% confidence interval for p1−p2p_1 - p_2 from the same data be likely to contain 00? What about a 90%90\% interval? Explain.
  • (b) Why is the answer to (a) only “likely”?

H10. (Challenge) A coach randomly assigns 2020 swimmers, 1010 to a new starting technique and 1010 to the usual one. After a month, 88 swimmers using the new technique and 33 using the usual one have improved their start time.

  • (a) Show that the Large Counts condition fails, so a z-test isn’t appropriate.
  • (b) Instead, the coach writes the 2020 results (1111 “improved”, 99 “not improved”) on cards, shuffles them, and deals them into two groups of 1010, recording the difference in proportions improved (new minus usual). Explain why this simulates what would happen if the technique made no difference.
  • (c) In 10001000 shuffles, 3535 gave a difference of 0.50.5 or more. Estimate the p-value and write a conclusion at α=0.05\alpha = 0.05.