Module 5: Estimation · Lesson 5.2 · about 20 min
Confidence intervals for a proportion
Intervals for percentages: conversion rates, survey shares, defect rates. The simple Wald formula, the better Wilson interval for small samples and rates near 0 % or 100 %, and the ±3 points of a 1,000-person poll.
Module 5 · about 20 minutes · school maths. You’ll be able to compute Wald and Wilson intervals for a proportion, know when the simple formula breaks, and read a poll’s margin of error.
In everyday terms: a poll of 1,000 people says “45 %, plus or minus 3 points”. That ±3 is the margin of error: the share in the whole country is very likely somewhere from 42 % to 48 %.
1. Percentages need intervals too
Conversion rates, click-through rates, survey percentages, defect rates and churn rates are all proportions: the share of yeses. They are the most common numbers an analyst reports, and they come with sampling error like any average (a proportion is the mean of 0s and 1s).
2. The Wald interval
From Lesson 3.2, has SE . Plug in and use 1.96:
Fine when and are both at least 10. It fails for small samples or rates near 0 % and 100 %: it can include impossible values below 0, or shrink to nothing when is 0.
3. The Wilson interval
Edwin Wilson’s 1927 interval fixes this by pulling the centre slightly towards 50 % and never leaving 0–100 %. With :
You’ll rarely compute it by hand; know that good tools use it (statsmodels proportion_confint(method="wilson")), and use it yourself when counts are small.
Slide p̂ to 2 % with n = 100: the Wald interval dips below zero, Wilson doesn’t. With large n both agree.
4. Reading polls
- “±3 points, 19 times out of 20” means a 95 % interval of about ±3 points for a 50 % answer with ~1,000 people.
- The margin applies to each percentage. The gap between two candidates (or two products) is noisier, roughly up to twice as wide.
- Subgroups have bigger margins: “among the 150 under-25s” might be ±8 points.
- The margin covers sampling error only, not bias (Lesson 4.2).
Rule of three: if 0 of items had a problem, the 95 % upper limit for the true rate is about . Zero complaints from 300 customers: true rate likely under 1 %.
- p̂ = x/n
- The share in your sample.
- √(p̂(1 − p̂)/n)
- Its standard error.
- Wald interval
- p̂ ± 1.96·SE. Simple, fine for large n and shares away from the edges.
- Wilson interval
- A better interval that never goes below 0 % or above 100 % and works for small n.
- Physical meaning
- A share is pulled hardest when it is near 50 % (the most uncertainty) and least near 0 or 100 %. That is why a 1,000-person poll is ±3 points at worst.
“0 defects in 50 units means the defect rate is 0 %.” It means the rate is probably low, not zero. The Wilson interval is 0 % to about 7 %; the rule of three gives roughly 3/n = 6 % as an upper bound.
Watch it happen, one step at a time:
Maths and principle
Principle: a proportion is an average of 0/1 values, so its interval is estimate ± multiplier × SE, with SE . Near 0 or 1 the curve is lopsided, which Wilson allows for.
Equations: Wald ; Wilson as above; worst-case margin (p = 0.5) , so roughly .
Quick rule: 95 % margin ≈ for answers near 50 %: n = 100 → ±10 points, 400 → ±5, 1,000 → ±3, 10,000 → ±1.
5. Worked example
Made-up numbers. 300 customers were asked about a new menu; 186 said they like it.
- = 186 ÷ 300 = 62 %.
- SE = √(0.62 × 0.38 ÷ 300) = √0.000785 ≈ 0.028.
- Wald: 0.62 ± 1.96 × 0.028 = 0.62 ± 0.055 → 56.5 % to 67.5 %.
- Wilson: about 56.4 % to 67.3 %. Practically the same, since n is decent and p̂ isn’t extreme.
Report: “62 % like the new menu (95 % CI 56 % to 67 %, n = 300).” The interval is above 50 %, so a majority of customers like the menu, provided the 300 were a fair sample.
6. Practice
- 45 of 900 orders were late. Find the Wald 95 % interval.
- 0 of 150 transactions were flagged. Rule-of-three upper limit?
- A poll of 2,500 has what rough worst-case margin?
Answers
- p̂ = 5 %; SE = √(0.05 × 0.95 ÷ 900) ≈ 0.00726; margin ≈ 1.4 points; CI ≈ 3.6 % to 6.4 %.
- 3 ÷ 150 = 2 %.
- 1 ÷ √2,500 = 1 ÷ 50 = ±2 points.
Try it on your own data: the hypothesis tests tool gives Wilson intervals for a count out of a total; the sample size calculator works the other way, from margin to n.
New words: proportion, Wald interval, Wilson interval, margin of error, rule of three.
- Share: p̂ ± 1.96 × √(p̂(1 − p̂)/n) for 95 % (Wald).
- Use the Wilson interval for small n or shares near 0 % or 100 %.
- The margin of error is largest at 50 %; ±3 points needs about 1,000 people.
- Zero events does not mean a zero rate; report an upper bound.
Check yourself
Sources
- OpenIntro Statistics, 4th edition (Diez, Cetinkaya-Rundel, Barr), Section 6.1 Inference for a single proportion https://www.openintro.org/book/os/
- Brown, L. D., Cai, T. T. and DasGupta, A. (2001), Interval Estimation for a Binomial Proportion, Statistical Science 16(2), 101-133 https://doi.org/10.1214/ss/1009213286
Your ticks stay in this browser. Save them as a file on the course home.
Updated 2026-11-22. Numbers in the examples are made up to show the idea unless a source is given. Simulations run in your browser; nothing you type is sent anywhere.