Learning Objectives
By the end of this note, you will compare $p_{1}$ versus $p_{2}$ with independent large samples, compute pooled $\bar{p}=(x_{1}+x_{2})/(n_{1}+n_{2})$, compute $z=(\hat{p}{1}-\hat{p}{2})/\sqrt{\bar{p}(1-\bar{p})(1/n_{1}+1/n_{2})}$, and give a CI with unpooled SE, using a BS 2081 two office example.
Why Compare Two Proportions With $z$
A province asks whether satisfaction with e filing is higher in Province Hospital A than in Province Hospital B. A ministry asks whether training completion rates differ between two districts. Each question compares two independent population shares $p_{1}$ and $p_{2}$. Sample shares $\hat{p}{1}=x{1}/n_{1}$ and $\hat{p}{2}=x{2}/n_{2}$ estimate them. With large samples, the difference $\hat{p}{1}-\hat{p}{2}$ is approximately normal, so a $z$ test judges whether the observed gap exceeds chance.
Grouped Framework: Conditions, Pooled SE, and Decision
Condition 1: Two independent proportion questions. Groups are distinct with no matching. Different offices, different Palikas, different cohorts. Matched pairs need a different test.
Condition 2: Large enough counts in each sample. Require for each group
\[n\hat{p}\ge 10\quad\text{and}\quad n(1-\hat{p})\ge 10\]or, equivalently under $H_{0}$, $n\bar{p}\ge 10$ and $n(1-\bar{p})\ge 10$. When counts are sparse, use Fisher exact or continuity methods.
Hypotheses.
\(H_{0}:p_{1}=p_{2}\quad\text{or}\quad p_{1}-p_{2}=0\) \(H_{1}:p_{1}\neq p_{2}\quad\text{or}\quad p_{1}>p_{2}\quad\text{or}\quad p_{1}<p_{2}\)
Pooled proportion under $H_{0}$. When $H_{0}$ claims a common $p$, pool successes:
\[\bar{p}=\frac{x_{1}+x_{2}}{n_{1}+n_{2}}\]Pooling estimates that common value more precisely than either sample alone.
Test statistic under $H_{0}$.
\[z=\frac{\hat{p}_{1}-\hat{p}_{2}}{\sqrt{\bar{p}(1-\bar{p})\left(1/n_{1}+1/n_{2}\right)}}\]Define
\[\text{SE}_{0}=\sqrt{\bar{p}(1-\bar{p})\left(1/n_{1}+1/n_{2}\right)}\]This SE assumes $H_{0}$ is true, so it uses $\bar{p}$.
Confidence interval for $p_{1}-p_{2}$. Intervals do not assume $H_{0}$, so use unpooled SE:
\[(\hat{p}_{1}-\hat{p}_{2})\pm z^{*}\sqrt{\frac{\hat{p}_{1}(1-\hat{p}_{1})}{n_{1}}+\frac{\hat{p}_{2}(1-\hat{p}_{2})}{n_{2}}}\]With $z^{*}=1.96$ for $95$ percent, $2.576$ for $99$ percent. Test with pooled SE, interval with unpooled SE.
Critical values and $p$ values.
| $H_{1}$ | Region | Critical at $0.05$ | $p$ form | ||||
|---|---|---|---|---|---|---|---|
| $\neq$ | $ | z | >z_{\alpha/2}$ | $\pm 1.96$ | $2P(Z> | z | )$ |
| $>$ | $z>z_{\alpha}$ | $+1.645$ | $P(Z>z)$ | ||||
| $<$ | $z< -z_{\alpha}$ | $-1.645$ | $P(Z<z)$ |
At $0.01$, use $\pm 2.576$ or $\pm 2.33$ one sided. A $95$ percent CI that excludes $0$ aligns with a two tailed reject at $0.05$.
Worked Example: Satisfaction Across Two Palika Offices in BS 2081
Context. In Kartik 2081, Lumbini Province audits citizen satisfaction tied to charter compliance in two Palikas that adopted the same online token system in Shrawan 2081. Palika A serves an urban centre, Palika B serves a mixed rural centre. Independent random exit surveys run in the same week: Palika A $n_{1}=200$, $x_{1}=160$ satisfied, $\hat{p}{1}=0.80$; Palika B $n{2}=250$, $x_{2}=175$ satisfied, $\hat{p}_{2}=0.70$. Test whether satisfaction differs at $\alpha=0.05$ two sided, then report the gap and a $95$ percent interval. The province funds service improvement at NPR 1500 per dissatisfied contact, so the point gap has budget meaning.
Step 1: Hypotheses.
\[H_{0}:p_{1}=p_{2}\quad\text{vs}\quad H_{1}:p_{1}\neq p_{2}\]Step 2: Conditions check. $n_{1}\hat{p}{1}=160$, $n{1}(1-\hat{p}{1})=40$, $n{2}\hat{p}{2}=175$, $n{2}(1-\hat{p}_{2})=75$, all $\ge 10$, so normal approximation holds.
Step 3: Pooled proportion.
\[\bar{p}=\frac{160+175}{200+250}=\frac{335}{450}\approx 0.744\]Step 4: SE under $H_{0}$ and $z$.
\[\text{SE}_{0}=\sqrt{0.744(0.256)\left(1/200+1/250\right)}=\sqrt{0.1905(0.009)}=\sqrt{0.00171}\approx 0.0414\] \[z=\frac{0.80-0.70}{0.0414}=\frac{0.10}{0.0414}\approx 2.42\]Step 5: Critical values and $p$ value.
Critical values $\pm 1.96$. Two tailed $p$:
\[p=2P(Z>2.42)=2(1-0.9922)=2(0.0078)=0.0156\]| Since $ | z | =2.42>1.96$ and $p<0.05$, reject $H_{0}$. |
Step 6: Conclude with unpooled interval.
\[\text{SE}_{\text{CI}}=\sqrt{\frac{0.80(0.20)}{200}+\frac{0.70(0.30)}{250}}=\sqrt{0.0008+0.00084}=\sqrt{0.00164}\approx 0.0405\] \[95\text{ percent CI: }0.10\pm 1.96(0.0405)=0.10\pm 0.079=(0.021,0.179)\]The interval says Palika A satisfaction sits $2.1$ to $17.9$ points above Palika B with $95$ percent confidence, which excludes $0$ and matches the test. At $10$ points on $450$ sampled contacts, about $45$ more satisfied users in the sample and several hundred at scale, which at NPR 1500 per poor experience maps to meaningful follow up at Palika B rather than system wide spending. At $\alpha=0.01$ with $\pm 2.576$, the same $2.42$ would fail to reject, so the report notes borderline strength.
Self-check
Try this (calculable): In Mangsir 2081, two districts test adoption of online building permits. District 1: $n_{1}=150$, $x_{1}=120$, $\hat{p}{1}=0.80$. District 2: $n{2}=180$, $x_{2}=126$, $\hat{p}{2}=0.70$. Test $H{0}:p_{1}=p_{2}$ vs $H_{1}:p_{1}>p_{2}$ at $\alpha=0.05$.
(a) Compute $\bar{p}$ and $\text{SE}{0}$. (b) Compute $z$ and $p=P(Z>z)$. Compare to critical $1.645$. (c) Give $95$ percent CI for $p{1}-p_{2}$ with unpooled SE and interpret.
Answer: (a) $\bar{p}=(120+126)/(150+180)=246/330\approx 0.745$, $\text{SE}{0}=\sqrt{0.745(0.255)(1/150+1/180)}\approx 0.0482$. (b) $z=(0.80-0.70)/0.0482\approx 2.07$, $p=1-0.9808=0.0192$. Since $2.07>1.645$ and $p<0.05$, reject $H{0}$, support higher adoption in district 1 by $10$ points. (c) $\text{SE}_{\text{CI}}=\sqrt{0.80(0.20)/150+0.70(0.30)/180}\approx 0.0473$, $95$ percent CI $0.10\pm 1.96(0.0473)=(0.007,0.193)$, which excludes $0$, consistent with one sided reject but two sided $95$ percent barely excludes $0$.
Check: recompute as two tailed with $\pm 1.96$ and $p=0.038$, which would still reject, and note the pooled versus unpooled SE gap.
Summary
| Compare $p_{1}$ and $p_{2}$ with independent large samples by pooling under $H_{0}$. Compute $\hat{p}{1}=x{1}/n_{1}$, $\hat{p}{2}=x{2}/n_{2}$, $\bar{p}=(x_{1}+x_{2})/(n_{1}+n_{2})$, then $z=(\hat{p}{1}-\hat{p}{2})/\sqrt{\bar{p}(1-\bar{p})(1/n_{1}+1/n_{2})}$, compare $ | z | $ to $z_{\alpha/2}$ or $z_{\alpha}$ or $p$ to $\alpha$, and report the point gap plus an unpooled confidence interval $(\hat{p}{1}-\hat{p}{2})\pm z^{*}\sqrt{\hat{p}{1}(1-\hat{p}{1})/n_{1}+\hat{p}{2}(1-\hat{p}{2})/n_{2}}$. The gap in points and its NPR implication separate statistical from practical significance. |
Key Takeaways
- Verify counts $n\hat{p}\ge 10$ and $n(1-\hat{p})\ge 10$ in each sample before $z$.
- Pool with $\bar{p}=(x_{1}+x_{2})/(n_{1}+n_{2})$ for the test SE, not for the interval.
- Compute $z=(\hat{p}{1}-\hat{p}{2})/\sqrt{\bar{p}(1-\bar{p})(1/n_{1}+1/n_{2})}$ under $H_{0}:p_{1}=p_{2}$.
- Keep test and interval SE distinct: pooled for test, unpooled for CI. A $95$ percent CI that excludes $0$ matches a two tailed reject at $0.05$.
- Report the gap in points and its budget meaning, for example $10$ points with CI $2.1$ to $17.9$.
Discussion
- An analyst uses unpooled SE in the test denominator. Why does this misstate the null model, and how does $\bar{p}$ versus separate $\hat{p}$ change $z$ when $n_{1}\neq n_{2}$?
- Two Palikas each have $n=30$, $\hat{p}{1}=0.80$, $\hat{p}{2}=0.60$. Why should you hesitate to use $z$ even though $n\ge 30$, and what counts rule makes the tail approximate?
- Your $99$ percent CI for $p_{1}-p_{2}$ is $(-0.02,0.18)$ while one sided $p=0.02$ rejects. How do confidence level and tail choice explain the mismatch?
Exercises
- Palika A $n_{1}=200$, $x_{1}=160$; Palika B $n_{2}=250$, $x_{2}=175$, $\alpha=0.05$ two tailed. Compute $\hat{p}{1}$, $\hat{p}{2}$, $\bar{p}$, $\text{SE}_{0}$, $z$, $p$, decision, and 95 percent CI with unpooled SE.
- District 1 $n_{1}=150$, $x_{1}=120$; District 2 $n_{2}=180$, $x_{2}=126$, test $>$ at $0.05$. Give $z\approx2.07$, critical $1.645$, $p$, and 95 percent CI.
- Voter policy favor: District 1 $n=400$, $180$ favor; District 2 $n=500$, $200$ favor, test $\neq$ at $0.01$. Compute $\bar{p}=380/900\approx0.422$, $z\approx1.51$, $p\approx0.13$, decision, and 99 percent CI with $2.576$.
- Explain why $z$ for two proportions uses $\bar{p}$ while the CI uses separate $\hat{p}$, and illustrate with the numeric gap between $\text{SE}{0}=0.0414$ and $\text{SE}{\text{CI}}=0.0405$.
- A report claims a $10$ point gap proves program success without giving $n$. Why is the gap uninterpretable without $n$ and SE, and what $n$ would make a $3$ point gap significant?


