Confidence intervals for the population proportion
Theory
A confidence interval for a population proportion \(p\) is the interval estimate \(\hat p \pm z\sqrt{\hat p(1-\hat p)/n}\), where \(\hat p=x/n\) is the sample proportion and \(z\) is the standard-normal quantile for the confidence level. The margin of error is \(E=z\sqrt{\hat p(1-\hat p)/n}\) and the interval width is \(2E\).
A point estimate of the population proportion \(p\) is the sample proportion \(\hat p=\dfrac{x}{n}\), where \(x\) of the \(n\) sampled units have the feature. Because a different sample would give a slightly different \(\hat p\), a single number is not enough: we report an interval estimate that is likely to contain \(p\).
The approximate confidence interval is \(\left(\hat p - z\sqrt{\tfrac{\hat p(1-\hat p)}{n}},\ \hat p + z\sqrt{\tfrac{\hat p(1-\hat p)}{n}}\right)\). The quantity \(\sqrt{\hat p(1-\hat p)/n}\) is the standard error of \(\hat p\), and \(z\) is the standard-normal quantile for the chosen confidence level: \(1.96\) for \(95\%\), \(1.645\) for \(90\%\) and \(2.576\) for \(99\%\).
The margin of error \(E=z\sqrt{\hat p(1-\hat p)/n}\) is how far the interval reaches either side of \(\hat p\); the interval is \(\hat p\pm E\) and its width is \(2E\). A larger sample makes the interval narrower; a higher confidence level makes it wider.
The point estimate (sample proportion):
The approximate confidence interval for \(p\):
The margin of error and the interval width:
The sample size for a target margin of error (round up):
How to build a confidence interval for a proportion
- Point estimate. Compute \(\hat p=\dfrac{x}{n}\) from the sample.
- Choose \(z\). Match the confidence level: \(1.96\) for \(95\%\), \(1.645\) for \(90\%\), \(2.576\) for \(99\%\).
- Standard error and margin. Find \(\sqrt{\hat p(1-\hat p)/n}\), then \(E=z\sqrt{\hat p(1-\hat p)/n}\).
- Form the interval. Report \(\hat p\pm E\), i.e. \((\hat p-E,\ \hat p+E)\); the width is \(2E\).
| \(\hat p\) | \(=\) | \(\dfrac{90}{250}\) |
| \(=\) | \(0.36\) |
| \(\text{SE}\) | \(=\) | \(\sqrt{\dfrac{0.36\times 0.64}{250}}\) |
| \(=\) | \(0.03036\) |
| \(E\) | \(=\) | \(1.96\times 0.03036\) |
| \(=\) | \(0.0595\) |
| \(\text{CI}\) | \(=\) | \(0.36\pm 0.0595\) |
| \(=\) | \((0.300,\ 0.420)\) |
| \(\text{SE}\) | \(=\) | \(\sqrt{\dfrac{0.5\times 0.5}{400}}\) |
| \(=\) | \(0.025\) |
| \(E\) | \(=\) | \(1.96\times 0.025\) |
| \(=\) | \(0.049\) |
| \(\text{width}\) | \(=\) | \(2\times 0.049\) |
| \(=\) | \(0.098\) |
| \(\text{SE}\) | \(=\) | \(\sqrt{\dfrac{0.4\times 0.6}{300}}\) |
| \(=\) | \(0.02828\) |
| \(E\) | \(=\) | \(1.96\times 0.02828=0.0554\) |
| \(\text{CI}\) | \(=\) | \(0.4\pm 0.0554\) |
| \(=\) | \((0.345,\,0.455)\) |
| \(E\) | \(=\) | \(2.576\times 0.02828=0.0729\) |
| \(\text{CI}\) | \(=\) | \(0.4\pm 0.0729\) |
| \(=\) | \((0.327,\,0.473)\) |
Higher confidence \(\Rightarrow\) larger \(z\) \(\Rightarrow\) wider interval.
| \(n\) | \(\ge\) | \(\dfrac{1.96^{2}\times 0.25}{0.03^{2}}\) |
| \(=\) | \(1067.1\ldots\) |
| \(n\) | \(=\) | \(1068\) |
Common pitfalls
Frequently asked questions
What is a confidence interval for a proportion?
An interval estimate for \(p\), calculated as \(\hat p\pm z\sqrt{\hat p(1-\hat p)/n}\), where \(\hat p=x/n\) and \(z\) is the standard-normal quantile for the confidence level.
What does 95% confidence mean?
If many samples were taken and an interval built from each, about \(95\%\) of those intervals would contain the true \(p\). It is not a probability for one particular interval.
Which z-value do I use?
\(1.96\) for \(95\%\), \(1.645\) for \(90\%\), \(2.576\) for \(99\%\). A higher confidence level uses a larger \(z\), giving a wider interval.
How is the margin of error related to the width?
The margin of error is \(E=z\sqrt{\hat p(1-\hat p)/n}\); the width is \(2E\), so the margin of error is half the width.
How do I find the required sample size?
Solve \(n\ge z^{2}\hat p(1-\hat p)/E^{2}\) and round up. With no estimate of \(p\), use \(\hat p=0.5\), which gives the largest (safest) sample size.
How do sample size and confidence level change the width?
A larger sample gives a narrower interval (width \(\propto 1/\sqrt{n}\)); a higher confidence level gives a wider interval.