All lessons

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.

Key points, meanings and formulas on one page: choose "Save as PDF" in the print box.

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.

A percentage from a sample needs a range too: p̂ ± 1.96 × √(p̂(1 − p̂)/n), or the Wilson interval when the sample is small or the share is near 0 % or 100 %.

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, pˆ has SE p(1−p)/n. Plug in pˆ and use 1.96:

pˆ±1.96pˆ(1−pˆ)n

Fine when npˆ and n(1−pˆ) 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 pˆ 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 z=1.96:

pˆ+z22n1+z2n±z1+z2npˆ(1−pˆ)n+z24n2

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.

Try it: margin of error for a percentage
margin of error (95 %)
simple (Wald) interval
Wilson interval
The curve is the 95 % margin of error, 1.96 × √(p̂(1 − p̂)/n), against sample size. A poll of 1,000 people has a margin of about ±3 points; 300 people, about ±5.5. The margin is largest at 50 % and shrinks towards 0 % and 100 %, where the simple formula breaks down (it can go below 0). The Wilson interval fixes that and is what good tools use.

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 n items had a problem, the 95 % upper limit for the true rate is about 3/n. 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:

The survey. 186 of 300 customers like the new menu.
Share. p̂ = 186 ÷ 300 = 0.62.
SE. √(0.62 × 0.38 ÷ 300) ≈ 0.028.
Margin. 1.96 × 0.028 ≈ 0.055, about 5.5 points.
Interval. 56.5 % to 67.5 %. All above 50 %: a majority likes the menu, if the 300 were a fair sample.
Maths and principle

Principle: a proportion is an average of 0/1 values, so its interval is estimate ± multiplier × SE, with SE p(1−p)/n. Near 0 or 1 the curve is lopsided, which Wilson allows for.

Equations: Wald pˆ±zpˆ(1−pˆ)/n; Wilson as above; worst-case margin (p = 0.5) ≈0.98/n, so roughly 1/n.

Quick rule: 95 % margin ≈ 1/n 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.

  • pˆ = 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

  1. 45 of 900 orders were late. Find the Wald 95 % interval.
  2. 0 of 150 transactions were flagged. Rule-of-three upper limit?
  3. A poll of 2,500 has what rough worst-case margin?
Answers
  1. p̂ = 5 %; SE = √(0.05 × 0.95 ÷ 900) ≈ 0.00726; margin ≈ 1.4 points; CI ≈ 3.6 % to 6.4 %.
  2. 3 ÷ 150 = 2 %.
  3. 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

1A survey of 1,000 finds 50 % support. What is the approximate 95 % margin of error?
20 of 40 customers reported a bug. The simple Wald interval is 0 % to 0 %. What is wrong?
3A conversion rate of 3 % is measured on 2,000 visitors. Which is closest to the 95 % interval?

Sources

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.