10. Inference for Two Proportions (Normal Model)
a. Hypothesis Test
Math 115
Where We’ve Been
Previously, we used randomization for two-proportion inference:
Permutation test: Shuffled outcomes to build null distribution
Bootstrap CI: Resampled with replacement for confidence interval
These methods work well, but require many simulations.
Question: Is there a mathematical shortcut?
In topic 9 we used randomization — permutation tests and bootstrap confidence intervals — for two-proportion inference. Both worked, but each required a thousand simulations. The question for topic 10 is whether there’s a mathematical shortcut here — the way the normal model gave us one for a single proportion back in topic six.
CPR Study (from 9a)
Do blood thinners affect survival during CPR? 90 patients randomly assigned to treatment (blood thinner) or control.
Control
39
11
50
Treatment
26
14
40
Total
65
25
90
Hypotheses (two-sided)
\(p_T, p_C\) = true survival rates (treatment, control).
\(H_0: p_T - p_C = 0\)
\(H_A: p_T - p_C \neq 0\)
Treatment: \(\hat{p}_T = 0.35\) (14 of 40)
Control: \(\hat{p}_C = 0.22\) (11 of 50)
Observed difference: \(\hat{p}_T - \hat{p}_C = 0.13\)
From 9a: permutation p-value \(\approx 0.27\) → failed to reject \(H_0\) . Today: does the normal model agree?
Today’s running example is the CPR study from nine A. The research question — do blood thinners affect survival during CPR? Ninety patients were randomly assigned, either to the treatment group, which received a blood thinner, or to the control group, which received standard care. Before computing anything, let’s frame the test. Let p T be the true survival rate in the treatment group, and p C be the true survival rate in the control group. The null hypothesis says the difference between them is zero — no effect of blood thinner on survival. The alternative says they differ, with no committed direction — so it’s a two-sided test. Now the data. Sample treatment survival rate, p hat T, is fourteen out of forty, or zero point three five. Sample control survival rate, p hat C, is eleven out of fifty, or zero point two two. Observed difference, treatment minus control, is about zero point one three — meaning patients on the blood thinner survived at a roughly thirteen-percentage-point higher rate than the control group. In nine A, the permutation test gave a p-value of about zero point two seven — well short of significance, so we failed to reject. Today’s question: does the normal model agree? The rest of the deck builds the machinery and then applies it to this difference.
The Mathematical Alternative
Just as we used the normal distribution for one proportion…
Topic 6: \(\hat{p} \sim N\!\left(p,\ \sqrt{p(1-p)/n}\right)\) when conditions hold — sampling distribution from theory, no simulation.
We can use the normal distribution for the difference in proportions too.
When conditions are met:
Results will be similar to randomization methods
P-values and CIs come from a formula instead of resampling
Faster computation, no simulation noise
Today’s goal: redo the CPR H-test with the normal model and see how the answer compares to 9a’s permutation result.
Remember from topic six — when conditions held, a single sample proportion was approximately normal, centered at p with standard deviation equal to the square root of p times one minus p, divided by n. Same idea will work for the difference of two sample proportions under the right conditions, but the details are a little different. That gives us p-values and confidence intervals from a formula instead of a thousand resamples. The trade-off is the conditions — they need to be checked before we can rely on the shortcut. Today’s goal is to redo the CPR hypothesis test we just set up and see how the normal-model answer compares to nine A’s permutation result.
Sampling Distribution: Difference in Proportions
When conditions are met, the sampling distribution is approximately normal with:
Mean: \(p_1 - p_2\) (the true difference)
Standard Error: \(SE = \sqrt{\frac{p_1(1-p_1)}{n_1} + \frac{p_2(1-p_2)}{n_2}}\)
Another CLT result. Just like \(\hat{p}\) in topic 6, the difference \(\hat{p}_1 - \hat{p}_2\) becomes approximately normal under independence + adequate sample size.
The SE uses the true \(p_1, p_2\) . What to plug in depends on the question — pooled \(\hat{p}_{pool}\) for an H-test (today), separate \(\hat{p}_1, \hat{p}_2\) for a CI (10b).
The sampling distribution of the difference between two sample proportions is approximately normal, centered at the true difference, with a standard error that combines the sampling variability of each of the two sample proportions. This is another instance of the Central Limit Theorem — just like a single p hat in topic six, the difference between two sample proportions becomes approximately normal as long as observations are independent and the samples are large enough. The SE formula uses the true p one and p two — which we don’t actually know. So we substitute our best stand-in. What we substitute depends on the question. For a hypothesis test, we use the pooled p hat — that’s coming up shortly. For a confidence interval, we use the separate sample proportions — that’s ten B.
Technical Conditions: H-Test
Two conditions to use the normal model for an H-test on two proportions:
Independence
Observations independent within and between groups (random sampling or random assignment)
randomized assignment ✓
Success-Failure
At least 10 expected successes AND failures in each group (expected = under \(H_0\) using \(\hat{p}_{pool}\) , next slide)
needs checking, next ?
H-test uses expected counts under \(H_0\) (via \(\hat{p}_{pool}\) ); CI uses observed counts (each group on its own).
For the hypothesis test on two proportions, there are two conditions to check. The first is independence — observations within and between groups must be independent, which we usually justify by random sampling or random assignment. The second is the success-failure condition: we need at least ten expected successes and ten expected failures in each group. “Expected” here means computed under the null, using the pooled p hat — and the pooled p hat is the next slide. The success-failure check comes in two flavors: the hypothesis test uses expected counts under the null via the pooled p hat, while the confidence interval uses observed counts with each group on its own. For CPR, independence is already satisfied because patients were randomly assigned. Success-failure we’ll check once we have the pooled value.
The Pooled Proportion
Under \(H_0: p_1 - p_2 = 0\) , both groups share a common proportion .
The pooled proportion estimates this common value:
\[\hat{p}_{pool} = \frac{\text{total successes}}{\text{total observations}} = \frac{n_1\hat{p}_1 + n_2\hat{p}_2}{n_1 + n_2}\]
Used for hypothesis testing because the null assumes the two proportions are equal.
Try it for CPR (total survivors / total patients):
\(\hat{p}_{pool} = \dfrac{25}{90} \approx 0.28\) — best estimate of the common survival rate under \(H_0\) .
Here’s the wrinkle. The null hypothesis says the two groups share a common true proportion — they’re equal. So under the null, our best estimate of that common value isn’t from one group or the other, but from pooling all the successes across both groups. That’s the pooled proportion. We use it for the hypothesis test SE because we’re computing what to expect under the null. Quick check before you advance: compute p pooled for the CPR data — total survivors over total patients. Twenty-five total survivors across ninety total patients comes out to about zero point two eight. That’s our best estimate of the common survival rate under the null.
Test Statistic for H-Test
The test statistic for a hypothesis test about a difference in proportions is the Z-score:
\[Z = \frac{(\hat{p}_1 - \hat{p}_2) - 0}{SE}\]
Where:
\(\hat{p}_1 - \hat{p}_2\) is the observed difference in sample proportions
0 is the null value (from \(H_0: p_1 - p_2 = 0\) )
\(SE = \sqrt{\hat{p}_{pool}(1-\hat{p}_{pool})\left(\frac{1}{n_1} + \frac{1}{n_2}\right)}\)
Both \(p_1, p_2\) in the theoretical SE are replaced by \(\hat{p}_{pool}\) — under \(H_0\) they’re equal.
With the pooled SE in hand, the test statistic is a Z-score. Observed difference, minus the null value of zero, divided by the SE. Same general shape as the one-proportion Z-test from topic six — what changes is the SE. The pooled SE is just the theoretical SE we wrote earlier with both p one and p two replaced by p pooled — because the null says those two true rates are equal.
Putting It Together for CPR
Hypotheses (two-sided): \(H_0: p_T - p_C = 0\) vs \(H_A: p_T - p_C \neq 0\)
Sample
Treatment: \(\hat{p}_T = 14/40 = 0.35\)
Control: \(\hat{p}_C = 11/50 = 0.22\)
Observed difference: \(\hat{p}_T - \hat{p}_C = 0.13\)
Under \(H_0\) : \(\hat{p}_{pool} = 25/90 \approx 0.28\)
Coming up: check success-failure → compute pooled SE → get \(Z\) → get p-value → conclude.
Quick recap of where we are with CPR. Hypotheses unchanged from nine A: null says no difference in survival rates, alternative says they differ — two-sided. From the data, treatment p hat is fourteen over forty, zero point three five; control p hat is eleven over fifty, zero point two two; observed difference is about zero point one three — meaning patients on the blood thinner survived at a thirteen percentage-point higher rate than the control group. Under the null, the pooled p hat is twenty-five over ninety, about zero point two eight — our best estimate of the common survival rate if the blood thinner truly had no effect. Next we check success-failure, then plug the observed difference of zero point one three and the pooled SE into Z, get a p-value, and conclude.
Expected Counts for H-Test
To check the success-failure condition, we calculate expected counts using \(\hat{p}_{pool}\) .
Expected successes and failures in each group:
Group 1: \(n_1 \times \hat{p}_{pool}\) successes, \(n_1 \times (1-\hat{p}_{pool})\) failures
Group 2: \(n_2 \times \hat{p}_{pool}\) successes, \(n_2 \times (1-\hat{p}_{pool})\) failures
All four values must be ≥ 10.
Before computing Z, we check success-failure. For a hypothesis test the check uses expected counts under the null — meaning we multiply each group’s sample size by p pooled to get expected successes, and by one minus p pooled to get expected failures. We need all four of those values to be at least ten.
Checking Conditions for CPR
Independence: Randomized experiment ✓
Success-Failure: Using pooled proportion \(\hat{p}_{pool} = \frac{25}{90} = 0.278\)
- Treatment: \(40 \times 0.278 = 11.1\) expected successes ✓
- Treatment: \(40 \times 0.722 = 28.9\) expected failures ✓
- Control: \(50 \times 0.278 = 13.9\) expected successes ✓
- Control: \(50 \times 0.722 = 36.1\) expected failures ✓
All ≥ 10, so conditions are met .
Doing the check for the CPR data — pooled proportion is twenty-five out of ninety, about zero point two eight. We need to check four expected counts against the cutoff of ten. Treatment expected successes — forty times zero point two eight is about eleven. Above ten. Treatment expected failures — forty times zero point seven two is about twenty-nine. Well above ten. Control expected successes — fifty times zero point two eight is about fourteen. Above ten. Control expected failures — fifty times zero point seven two is about thirty-six. Well above ten. All four exceed ten, so the success-failure condition is met.
Computing the Test Statistic
Pooled SE:
\[SE = \sqrt{0.278 \times 0.722 \times \left(\frac{1}{40} + \frac{1}{50}\right)} = 0.095\]
Try it: plug into \(Z = \dfrac{(\hat{p}_T - \hat{p}_C) - 0}{SE}\) .
\(Z = \dfrac{0.13 - 0}{0.095} \approx 1.37\) — a Z of about 1.4 is mildly large but not extreme.
Pooled SE works out to about zero point zero nine five. Try computing Z yourself before advancing — observed difference of zero point one three divided by the SE. Z equals zero point one three divided by zero point zero nine five, which is about one point three seven. A Z-score of around one point four is mildly large but not extreme.
Calculating the P-value
Two-sided p-value = 2 × (smaller-tail area) = \(2 \times 0.0856 \approx 0.171\)
The two-sided p-value is twice the smaller tail, which here is the upper tail past Z equals one point three seven. That tail area is about zero point zero eight six, so the two-sided p-value is about zero point one seven. In plain terms: if blood thinner had no effect on survival, we’d see a gap this extreme or more — in either direction — about seventeen percent of the time just by chance. Same conclusion as the permutation test in nine A — though the two p-values themselves aren’t identical. We’ll compare the methods more carefully in ten C.
Conclusion for CPR
Results:
Observed difference: \(\hat{p}_T - \hat{p}_C = 0.13\)
Z-score = 1.37
P-value = 0.171
Using \(\alpha = 0.05\) : P-value > 0.05, so do not reject \(H_0\)
Conclusion: The data do not provide convincing evidence that blood thinners affect survival rate during CPR.
In plain terms: if blood thinner had no effect on survival, we’d see a gap this extreme or more — in either direction — about 17% of the time just by chance.
Scope of inference:
Causation: random assignment → a significant result would support causation.
Generalization: not a random sample → conclusions extend only to similar cardiac-arrest patients.
Putting it together, Z is one point three seven and the p-value is zero point one seven, well above zero point zero five. We fail to reject the null — the same conclusion as the permutation test in nine A. The data do not provide convincing evidence that blood thinners affect survival rate. On scope of inference: random assignment means a significant result would have supported a causal claim, but the patients were not a random sample, so any conclusion applies only to similar cardiac-arrest patients in similar settings.
Stents — Hypotheses & Data
Do stents affect stroke rate? Same study from 9a — patients were randomly assigned to stent (224) vs. control (227); not a random sample . From 9a: permutation p-value \(\approx 0.004\) → rejected \(H_0\) .
Control
214
13
227
Treatment
191
33
224
Total
405
46
451
State \(H_0\) and \(H_A\) for \(p_T - p_C\) (two-sided). \(H_0: p_T - p_C = 0\) \(H_A: p_T - p_C \neq 0\)
Compute \(\hat{p}_T\) , \(\hat{p}_C\) , and the observed difference \(\hat{p}_T - \hat{p}_C\) . \(\hat{p}_T = 33/224 \approx 0.147\) ; \(\hat{p}_C = 13/227 \approx 0.057\) ; \(\hat{p}_T - \hat{p}_C \approx 0.090\)
Now for your turn — do stents affect stroke rate? In this study from nine A, patients were randomly assigned, two hundred twenty-four to receive a stent and two hundred twenty-seven to receive standard medical care — the control. Note they were volunteers from a specific clinical setting — not a random sample of all stroke patients. The two-sided permutation test in nine A gave a p-value of about zero point zero zero four, so we rejected the null. Today: does the normal model agree? Start by writing the hypotheses, then calculate the sample proportions. Advance when you are ready to see the answers. Two-sided test on the difference in stroke rates. Null: p T minus p C equals zero — stents and control have the same stroke rate. Alternative: p T minus p C is not zero — the rates differ, with no committed direction. Treatment stroke rate is thirty-three over two hundred twenty-four, about zero point one four seven. Control is thirteen over two hundred twenty-seven, about zero point zero five seven. Observed difference is about zero point zero nine. In the sample, the stent group had a roughly nine-percentage-point higher stroke rate than the control group.
Stents — Conditions Check
Control
214
13
227
Treatment
191
33
224
Total
405
46
451
Compute \(\hat{p}_{pool}\) . \(\hat{p}_{pool} = 46/451 \approx 0.102\)
Check success-failure: are all four expected counts ≥ 10? Treatment: \(224 \times 0.102 \approx 22.8\) successes; \(224 \times 0.898 \approx 201.2\) failures.Control: \(227 \times 0.102 \approx 23.2\) successes; \(227 \times 0.898 \approx 203.8\) failures. All four ≥ 10 ✓
Same table from the previous slide, repeated here so you can read the counts off as you compute. Two quick steps for the conditions check — try them yourself before advancing to see the solutions. First, p pooled — that’s the total strokes over the total patients, forty-six over four hundred fifty-one, about zero point one zero two. Now check success-failure with expected counts. Treatment: two hundred twenty-four times zero point one zero two is about twenty-three expected successes, and two hundred twenty-four times zero point eight nine eight is about two hundred one expected failures. Control: two hundred twenty-seven times zero point one zero two is about twenty-three expected successes, and two hundred twenty-seven times zero point eight nine eight is about two hundred four expected failures. All four sit well above ten, so the condition is satisfied. Conditions met — we can use the normal model on the next slide.
Stents — Z and Conclusion
Recall: observed difference \(\approx 0.090\) ; \(\hat{p}_{pool} \approx 0.102\) ; conditions met. Random assignment; not a random sample.
Compute the pooled SE. \(SE = \sqrt{0.102 \times 0.898 \times (1/224 + 1/227)} \approx 0.0285\)
Compute \(Z\) . \(Z = 0.090 / 0.0285 \approx 3.16\)
Two-sided p-value for \(Z \approx 3.16\) is about \(0.0016\) . Conclusion at \(\alpha = 0.05\) (including scope)? \(p \ll 0.05\) → reject \(H_0\) . Stents affect stroke rate. Causation: randomized → causal. Generalization: not a random sample → applies to similar populations only. Matches 9a’s conclusion.
Conditions are met, so we can proceed with the normal model. Three quick steps to wrap up — try each one yourself before advancing to see the solution. Plug into the pooled SE formula — zero point one zero two times zero point eight nine eight, times the sum one over two hundred twenty-four plus one over two hundred twenty-seven, then take the square root. SE comes out to about zero point zero two eight five. Then Z is zero point zero nine divided by zero point zero two eight five, which is about three point one six. A Z of three point one six gives a two-sided p-value of about zero point zero zero one six, far below zero point zero five, so we reject the null. The data provide convincing evidence that stents affect short-term stroke rate. On scope: random assignment means stents caused the difference. The patients were not a random sample, so the conclusion applies only to similar patient populations. This matches the permutation conclusion from nine A — the two methods agree.
Looking Ahead
We’ve tested “Is there a difference?” with the normal model.
Next time: a normal CI for \(p_1 - p_2\) — “How big is the difference?”
That wraps up the hypothesis test side of the normal model, which answered whether there is a difference. Next time we turn to the matching confidence interval side, which answers how big the difference is.