Carrying Out a Test for a Difference in Proportions
How to compute the two-sample z test statistic with the pooled proportion, find and interpret the p-value, and write a conclusion in context about the difference between two population proportions.
Assume the two population proportions are equal. Then measure how far the observed difference \(\hat{p}_1 - \hat{p}_2\) is from 0, in standard deviations: that is the z test statistic. The p-value is how often a difference at least that far out would happen by chance if H₀ were true. A small p-value is convincing evidence of a difference.
1The test statistic
The numerator is the observed difference minus the difference H₀ claims, 0. The denominator is the standard deviation of \(\hat{p}_1 - \hat{p}_2\) when H₀ is true. Because H₀ says the two proportions are equal, it uses one shared estimate: the pooled proportion \(\hat{p}_c\), the proportion of successes for the two groups combined. When the null hypothesis is true, z has a standard normal distribution.
A confidence interval uses each sample’s own \(\hat{p}\) because it assumes nothing about the proportions. A test assumes H₀, so it uses \(\hat{p}_c\) in both places. For the texting data the pooled standard error is 0.0625; the separate one is 0.0617. The difference is small here, but the procedures are not interchangeable.
2The p-value
The p-value comes from the standard normal distribution, using a table or technology. It is the probability of a test statistic as extreme as or more extreme than the one observed, in the direction of the alternative, assuming H₀ is true.
| Alternative | p-value |
|---|---|
| \(H_a: p_1 - p_2 \gt 0\) | \(P(Z \ge z)\), the right tail |
| \(H_a: p_1 - p_2 \lt 0\) | \(P(Z \le z)\), the left tail |
| \(H_a: p_1 - p_2 \ne 0\) | \(2P(Z \ge |z|)\), both tails |
Reminder texts
Interpret the p-value of 0.0082 from the reminder-text test.
- 1Start with the assumption: H₀ in context, the two treatments have the same turn-in proportion.
- 2Then the observed result and the direction of the alternative: a difference of 0.15 or more.
- 3Finish with the group sizes: 120 and 120.
“Assuming that a reminder text makes no difference in the proportion of students like these who turn in missed work, there is a 0.0082 probability of getting a difference in sample proportions (text minus no text) of 0.15 or more in groups of 120 and 120.”
The p-value of 0.0082 is computed assuming H₀ is true. It is the probability of data like ours under that assumption, not the probability that texts have no effect.
3The decision and the conclusion
The formal decision compares the p-value with the significance level α. If the p-value ≤ α, reject \(H_0\). If the p-value \(\gt\) α, fail to reject \(H_0\). Then answer the question in context, in terms of the alternative hypothesis, with non-definitive language, naming the parameters and the populations.
“Because the p-value of 0.0082 is less than α = 0.05, we reject H₀. There is convincing evidence that a reminder text increases the proportion of students like these who turn in missed work within two days.”
With a p-value of 0.354, the lunch data are consistent with no difference, but they are also consistent with a modest one. Write “there is not convincing evidence that the proportions differ,” never “the proportions are the same.”
The walking test compares two schools sampled at random. It gives convincing evidence that the proportions differ, not that anything about a school causes students to walk. Cause and effect needs random assignment, as in the texting experiment.
4Three tests, start to finish
Reminder texts
A school randomly assigned 240 students who missed an assignment to get a reminder text (120) or no text (120). 84 of the texted students and 66 of the others turned in the work within two days. Do the data give convincing evidence at \(\alpha = 0.05\) that a text increases the proportion who turn it in?
- 1State. \(H_0: p_1 - p_2 = 0\), \(H_a: p_1 - p_2 \gt 0\), where \(p_1\) and \(p_2\) are the true proportions of students like these who turn in missed work within two days with a text and without one. \(\alpha = 0.05\).
- 2Plan. Two-sample z-test for the difference between two population proportions. Randomization: treatments were randomly assigned. Normality: \(\hat{p}_c = 150/240 = 0.625\); expected counts 75, 45, 75, 45 are all at least 10.
- 3Do. \(\hat{p}_1 = 0.70\), \(\hat{p}_2 = 0.55\). \(z = \dfrac{0.70 - 0.55 - 0}{\sqrt{0.625(0.375)\left(\frac{1}{120} + \frac{1}{120}\right)}} = \dfrac{0.15}{0.0625} = 2.40\). p-value \(= P(Z \ge 2.40) \approx 0.0082\).
- 4Conclude. Because the p-value of 0.0082 is less than \(\alpha = 0.05\), we reject \(H_0\). There is convincing evidence that a reminder text increases the proportion of students like these who turn in missed work within two days.
STAT, TESTS, 2-PropZTest. Enter x1 = 84, n1 = 120, x2 = 66, n2 = 120, choose p1 > p2, and Calculate. The output shows z = 2.4, p = 0.0082, and the pooled proportion \(\hat{p} = 0.625\). The calculator pools automatically.
Walking to school
Independent random samples from two large schools found 33 of 150 students at School 1 and 21 of 160 at School 2 walk to school. Test at \(\alpha = 0.05\) whether the proportions differ.
- 1\(H_0: p_1 = p_2\), \(H_a: p_1 \ne p_2\). Conditions: independent random samples; each sample is no more than 10% of its school; pooled expected counts 26.1, 123.9, 27.9 and 132.1 are all at least 10.
- 2\(\hat{p}_1 = 0.22\), \(\hat{p}_2 \approx 0.131\), difference \(\approx 0.089\). \(\hat{p}_c = 54/310 \approx 0.174\).
- 3\(SE = \sqrt{0.174(0.826)\left(\frac{1}{150} + \frac{1}{160}\right)} \approx 0.0431\), so \(z \approx 0.089/0.0431 \approx 2.06\).
- 4Two-sided: p-value \(= 2P(Z \ge 2.06) \approx 2(0.0198) = 0.0395\).
Lunch from home
Random samples in a large school district found 62 of 180 tenth graders and 60 of 200 twelfth graders usually bring lunch from home. Test at \(\alpha = 0.05\) whether the proportions differ.
- 1\(H_0: p_1 = p_2\), \(H_a: p_1 \ne p_2\). Pooled \(\hat{p}_c = 122/380 \approx 0.321\); expected counts 57.8, 122.2, 64.2, 135.8 are all at least 10.
- 2\(\hat{p}_1 \approx 0.344\), \(\hat{p}_2 = 0.30\). \(SE \approx 0.0480\), \(z \approx 0.044/0.0480 \approx 0.93\).
- 3Two-sided p-value \(\approx 0.354\).
Quick reference
| Step | What to write |
|---|---|
| Pooled proportion | \(\hat{p}_c\) = total successes ÷ total sample size |
| Test statistic | \(z = (\hat{p}_1 - \hat{p}_2) / \sqrt{\hat{p}_c(1-\hat{p}_c)(1/n_1 + 1/n_2)}\) |
| p-value | Standard normal tail(s) in the direction of \(H_a\) |
| Decision | p-value ≤ α: reject \(H_0\); p-value \(\gt\) α: fail to reject \(H_0\) |
| Conclusion | Convincing evidence (or not) for \(H_a\), in context, naming both populations |
| Calculator | 2-PropZTest |