cpr 1 dataset we explored in Ch. 14| group | died | survived | total |
|---|---|---|---|
| control | 39 | 11 | 50 |
| treatment | 26 | 14 | 40 |
| total | 65 | 25 | 90 |
Difference in proportions of “survived”: \[\hat{p}_T-\hat{p}_C=\frac{14}{40}-\frac{11}{50}=0.13\]

Sampling distribution of \(\hat{p}_1-\hat{p}_2\)
The sampling distribution of \(\hat{p}_1-\hat{p}_2\) based on samples of size \(n_1\) and \(n_2\) and population proportions \(p_1\) and \(p_2\) will be approximately normal with mean \(p_1-p_2\) and standard error \[SE(\hat{p}_1-\hat{p}_2)=\sqrt{\frac{p_1(1-p_1)}{n_1}+\frac{p_2(1-p_2)}{n_2}}\]
if the following technical conditions are met:
| group | died | survived | total |
|---|---|---|---|
| control | 39 | 11 | 50 |
| treatment | 26 | 14 | 40 |
| total | 65 | 25 | 90 |
cpr study Treatment group
cpr study Control group
The hypothesis test using a normal approximation uses the \(Z\) score as the test statistic \[Z = \frac{(\hat{p}_1-\hat{p}_2) - 0}{\sqrt{\hat{p}_{pool}(1-\hat{p}_{pool})\left(\frac{1}{n_1}+\frac{1}{n_2}\right)}}\]
For the cpr example the Z score is \[Z=\frac{(\hat{p}_T-\hat{p}_C)-0}{SE}=\frac{0.13-0}{0.095}=1.37\]
Note that the denominator is the SE estimate we saw in the previous slide
When the conditions are met, \(Z\) will have a standard normal distribution \(N(0,1)\)
The 2-sided p-value is the area under the density curve for \(N(0,1)\) that is more extreme than the observed difference (\(\leq-1.37\) or \(\geq1.37\))
cpr data.0.13)
info <- cpr_boot |>
summarize(ci_lo = quantile(stat, 0.025),
ci_hi = quantile(stat, 0.975),
midpoint =mean(stat))
info# A tibble: 1 × 3
ci_lo ci_hi midpoint
<dbl> <dbl> <dbl>
1 -0.0550 0.313 0.134

| group | died | survived | total |
|---|---|---|---|
| control | 39 | 11 | 50 |
| treatment | 26 | 14 | 40 |
| total | 65 | 25 | 90 |
| Type | Interval |
|---|---|
| Bootstrap Percentile | (-0.055, 0.313) |
| Bootstrap SE | (-0.055, 0.315) |
| Normal Approximation | (-0.057, 0.317) |