10. Inference for Two Proportions (Normal Model)

a. Hypothesis Test
Math 115

Yurk

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?

CPR Study (from 9a)

Do blood thinners affect survival during CPR? 90 patients randomly assigned to treatment (blood thinner) or control.

Group Died Survived Total
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?

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.

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).

Technical Conditions: H-Test

Two conditions to use the normal model for an H-test on two proportions:

Condition Rule For CPR
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).

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\).

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.

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.

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.

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.

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.

Calculating the P-value

Two-sided p-value = 2 × (smaller-tail area) = \(2 \times 0.0856 \approx 0.171\)

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.

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\).

Group No event Stroke Total
Control 214 13 227
Treatment 191 33 224
Total 405 46 451
  1. 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\)

  2. 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\)

Stents — Conditions Check

Group No event Stroke Total
Control 214 13 227
Treatment 191 33 224
Total 405 46 451
  1. Compute \(\hat{p}_{pool}\). \(\hat{p}_{pool} = 46/451 \approx 0.102\)

  2. 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 ✓

Stents — Z and Conclusion

Recall: observed difference \(\approx 0.090\); \(\hat{p}_{pool} \approx 0.102\); conditions met. Random assignment; not a random sample.

  1. Compute the pooled SE. \(SE = \sqrt{0.102 \times 0.898 \times (1/224 + 1/227)} \approx 0.0285\)

  2. Compute \(Z\). \(Z = 0.090 / 0.0285 \approx 3.16\)

  3. 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.

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?”

References