Educerie

Educerie · AP · Statistics

AP Statistics 3.13

Carrying Out a Test for the Difference Between Two Population Proportions

How can we determine whether the difference between two groups is statistically significant?

What you will learn

  • Know that the test statistic divides p-hat1 minus p-hat2 by the pooled standard error
  • Understand that the p-value is found in the tail Ha points to and read assuming the proportions are equal
  • Know that the decision compares the p-value with alpha
  • Understand how to state a conclusion about Ha in context, matched to the design

You must be able to

  1. Calculate z with the pooled standard error and find the p-value
  2. Interpret the p-value in context
  3. Make a decision by comparing the p-value with alpha
  4. Write a conclusion in context in non-definitive language
  5. Carry out a complete two-proportion test on an experiment
  6. Say what the design allows: cause and effect or generalizing

In the exam. Section I multiple choice: find the test statistic or its standard error, read a p-value, or choose the right decision and conclusion. Section II: a two-proportion zz-test on a randomized experiment is the Question 3 in the course description's sample paper. The calculation, the p-value interpretation, the comparison with α\alpha and the conclusion in context each carry a mark. Skills: calculate (3.E), interpret (4.F), justify a claim (4.G).

1The test statistic

z=(p^1−p^2)−0p^c(1−p^c)1n1+1n2the sheet’s form: the 0 is the difference assumed by H0z = \frac{(\hat{p}_1 - \hat{p}_2) - 0}{\sqrt{\hat{p}_c(1-\hat{p}_c)}\sqrt{\dfrac{1}{n_1} + \dfrac{1}{n_2}}} \qquad \textcolor{#838c91}{\text{the sheet's form: the 0 is the difference assumed by H0}}p^c=n1p^1+n2p^2n1+n2=x1+x2n1+n2successes of both groups over both sample sizes\hat{p}_c = \frac{n_1\hat{p}_1 + n_2\hat{p}_2}{n_1 + n_2} = \frac{x_1 + x_2}{n_1 + n_2} \qquad \textcolor{#838c91}{\text{successes of both groups over both sample sizes}}

The denominator is the standard error when p1=p2p_1 = p_2 is assumed. Both groups share the same p^c\hat{p}_c, so it appears once.

This differs from the interval's standard error, where each group keeps its own p^\hat{p}. The reason is the logic of the test. The null says the proportions are equal, so we use the best single estimate of that common proportion. The test statistic has a standard normal distribution when H0H_0 is true and the conditions hold.

2A full test on an experiment

Use Example A from 3.12. A designer thinks a flashcard quiz format will help students finish an online module within a week more often than a reading format does. 150 students were randomly assigned: 75 to the quiz format and 75 to the reading format. 51 of the quiz students and 39 of the reading students finished. Test at α=0.05\alpha = 0.05.

Procedure. Two-sample zz-test for the difference between two population proportions.

Parameters and hypotheses.

  • p1p_1 = the proportion of students like these who would finish the module within a week with the quiz format.
  • p2p_2 = the proportion who would finish within a week with the reading format.
H0:p1=p2H_0 : p_1 = p_2Ha:p1>p2H_a : p_1 > p_2

Conditions.

  • Randomization: the students were randomly assigned to the two formats.
  • 10%: not needed for a randomized experiment.
  • Normality: p^c=90/150=0.60\hat{p}_c = 90/150 = 0.60. 75(0.60)=4575(0.60) = 45 and 75(0.40)=3075(0.40) = 30 for each group. All four are at least 10.

Calculation.

p^1=5175=0.68p^2=3975=0.52\hat{p}_1 = \frac{51}{75} = 0.68 \qquad \hat{p}_2 = \frac{39}{75} = 0.52z=0.68−0.520.60(0.40)175+175=0.160.0800=2.00the sample difference is 2.00 standard deviations above 0\begin{aligned}z &= \frac{0.68 - 0.52}{\sqrt{0.60(0.40)}\sqrt{\dfrac{1}{75} + \dfrac{1}{75}}} \\[6pt] &= \frac{0.16}{0.0800} \\[6pt] &= 2.00 && \textcolor{#838c91}{\text{the sample difference is 2.00 standard deviations above 0}}\end{aligned}p-value=P(z≥2.00)=0.0228the upper tail, because Ha is p1 greater than p2p\text{-value} = P(z \ge 2.00) = 0.0228 \qquad \textcolor{#838c91}{\text{the upper tail, because Ha is p1 greater than p2}}
Figure 1. The null distribution of the difference in sample proportions when p1 = p2, for two groups of 75 with a combined proportion of 0.60: approximately normal, mean 0, standard deviation 0.08. The observed difference of 0.16 is 2.00 standard deviations above 0; the shaded area to its right, the p-value, is 0.023 −0.2 −0.1 0 0.1 0.2 difference in sample proportions p₁ = p₂ assumed observed 0.16 p-value 0.023
Figure 1 · The null distribution of the difference in sample proportions when p1 = p2: the observed difference of 0.16 is 2.00 standard deviations above 0, and the area to its right is 0.023

Figure 1 shows the null distribution on the scale of the difference. It is centered on 0, because H0H_0 says the proportions are equal. Its standard deviation is 0.08. The observed difference of 0.16 is twice that, and the shaded area to its right is the p-value.

Interpretation of the p-value. Assuming the proportion of students like these who finish within a week is the same with both formats, the probability of getting a difference in sample proportions (quiz minus reading) of 0.16 or more, by random assignment alone, is 0.023.

Decision. Since the p-value of 0.0228 is less than α=0.05\alpha = 0.05, we reject H0H_0.

Conclusion. There is convincing evidence that the proportion of students like these who finish the module within a week is greater with the quiz format than with the reading format. Because the students were randomly assigned, the difference can be attributed to the study format. Because they were not randomly sampled, the conclusion applies to students like these, not to all students.

3A two-sided test on two samples

Use Example B from 3.12: independent random samples of 160 commuters in City M (44 bicycle commuters) and 200 in City N (62). Is there convincing evidence that the proportions of bicycle commuters differ? Test at α=0.05\alpha = 0.05.

H0:p1=p2Ha:p1≠p2H_0 : p_1 = p_2 \qquad H_a : p_1 \ne p_2

The conditions were checked in 3.12 (independent random samples, each less than 10% of its population, all four expected counts at least 10).

p^1=44160=0.275p^2=62200=0.310p^c=106360=0.294\hat{p}_1 = \frac{44}{160} = 0.275 \qquad \hat{p}_2 = \frac{62}{200} = 0.310 \qquad \hat{p}_c = \frac{106}{360} = 0.294z=0.275−0.3100.294(0.706)1160+1200=−0.0350.0483=−0.72\begin{aligned}z &= \frac{0.275 - 0.310}{\sqrt{0.294(0.706)}\sqrt{\dfrac{1}{160} + \dfrac{1}{200}}} \\[6pt] &= \frac{-0.035}{0.0483} \\[6pt] &= -0.72\end{aligned}p-value=2 P(z≤−0.72)=2(0.2358)=0.47both tails, because Ha is not equal top\text{-value} = 2\,P(z \le -0.72) = 2(0.2358) = 0.47 \qquad \textcolor{#838c91}{\text{both tails, because Ha is not equal to}}

Since the p-value of 0.47 is greater than 0.05, we fail to reject H0H_0. The data do not provide convincing evidence that the proportion of all commuters in City M who commute by bicycle differs from the proportion in City N.

The sample proportions are different (0.275 and 0.310). That gap is small next to the sampling variability for samples of this size. A difference like it would be very common if the cities were the same.

Note what you may not say: "the two cities have the same proportion." The test failed to find a difference. It did not show there is none.

4Checking the answer against an interval

A 95% interval for p1−p2p_1 - p_2 in the City M and City N data uses the unpooled standard error, 0.275(0.725)/160+0.310(0.690)/200=0.0481\sqrt{0.275(0.725)/160 + 0.310(0.690)/200} = 0.0481. It is −0.035±1.96(0.0481)=(−0.129,0.059)-0.035 \pm 1.96(0.0481) = (-0.129, 0.059). Zero is inside. That agrees with failing to reject the two-sided null at 5%.

The interval and the test use slightly different standard errors (separate for the interval, pooled for the test), so a result very close to the cut-off could differ. The interval has an advantage: it also shows how large the difference could be, which a bare decision does not.

5How α\alpha and the sample size act

  • Change α\alpha and the same p-value can lead to a different decision. At α=0.01\alpha = 0.01, the quiz experiment's p-value of 0.0228 is greater than 0.01, so you would fail to reject. The α\alpha is chosen before the data.
  • Doubling both groups to 150, with the same sample proportions (0.68 and 0.52), makes the standard error smaller by a factor of 2\sqrt{2}. The zz would be about 2.83. The same observed gap is stronger evidence from a bigger sample.

Practice questions

30 questions on this note, from easy to hard. Each one you get right lights a star of this topic's constellation.