Module 5: Estimation · Lesson 5.4 · about 20 min
How big a sample do you need?
Plan a sample from the precision you need: n = (z × σ / margin)² for a mean and z² × p(1−p) / margin² for a proportion. Guessing σ and p, why population size barely matters, and planning for non-response and subgroups.
Module 5 · about 20 minutes · school maths. You’ll be able to work out a sample size for a mean or a proportion, choose sensible guesses for σ and p, and adjust for response rates and subgroups.
In everyday terms: before buying paint you measure the wall. Before a survey you decide how close the answer must be (the margin) and how much people vary (σ or p), and the sample size follows.
1. Start from the decision
Before collecting data, ask: how precise does the answer need to be to make the decision? A ±10-point answer is enough to tell “most customers want this” from “few do”. Setting a price might need ±1 point. Precision is expensive (the square-root law), so don’t buy more than the decision needs.
2. The formulas
Turn the margin formula around. For a proportion with margin :
For a mean:
with = 1.96 for 95 %. Round up.
Guessing the inputs.
- : use 0.5 if you have no idea; it gives the largest n, so you’re safe. If past data says about 10 %, use 0.1 (much smaller n).
- : from past data, a pilot, or range ÷ 4 as a rough guess (about 95 % of normal data lies within ±2σ).
3. Adjustments
- Response rate: invite n ÷ (expected response rate).
- Subgroups: if each region must be reported separately, each needs its own n.
- Finite population: if n is more than about 5 % of the population N, the corrected size is . For 385 out of 2,000 employees: 385 ÷ 1.192 ≈ 323.
- Comparisons between groups (A/B tests) need a different calculation, with power, in Lesson 7.3. Precision for one number isn’t the same as being able to detect a difference.
- Margin E
- How close you need to be, such as ±$5 or ±3 points.
- n = (z·σ / E)²
- Sample size for a mean.
- n = z²·p(1 − p) / E²
- Sample size for a share; use p = 0.5 if you have no idea (the worst case).
- Physical meaning
- Precision costs in squares: halving the margin needs four times the sample. Population size barely enters, so a national survey and a city survey need about the same n.
“Survey 10 % of the population.” Rules based on a share of the population waste money on big populations and fall short on small precise questions. Start from the margin you need.
Watch it happen, one step at a time:
Maths and principle
Principle: the margin of error is and SE shrinks like , so solving for n gives a square: halving the margin quadruples n.
Equations: , , .
Handy numbers (95 %, p = 0.5): ±10 points → 97; ±5 → 385; ±3 → 1,068; ±2 → 2,401; ±1 → 9,604.
4. Worked example
Made-up numbers. A grocery chain wants average weekly grocery spend of its loyalty members to within ±$5, 95 % confidence. Last year’s data suggests σ ≈ $60.
- n = (1.96 × 60 ÷ 5)² = (23.52)² ≈ 553.2, so 554 members.
- Response rate to past surveys: 20 %. Invitations: 554 ÷ 0.2 = 2,770.
- Management also wants each of 3 provinces to ±$8: per province (1.96 × 60 ÷ 8)² ≈ 216.1, so 217, which is 651 in total. That beats 554, so plan for 651 responses (about 3,255 invitations), spread so each province gets at least 217.
5. Practice
- Proportion, ±4 points, 95 %, p unknown. n?
- Mean, σ = 15, margin ±2, 95 %. n?
- Past churn is about 8 %. For ±2 points, how many customers? Compare with the p = 0.5 answer.
Answers
- 0.9604 ÷ 0.0016 ≈ 600.25, so 601.
- (1.96 × 15 ÷ 2)² = 14.7² ≈ 216.1, so 217.
- 3.8416 × 0.08 × 0.92 ÷ 0.0004 ≈ 706.9, so 707. With p = 0.5: 2,401. Knowing p is around 8 % saves about 70 % of the sample.
Try it on your own data: the sample size calculator does these sums, including finite populations and response rates.
New words: sample size, margin of error, pilot study, finite population correction, response rate.
- Start from the decision: what margin of error would change it?
- Mean: n = (z·σ / E)²; share: n = z²·p(1 − p)/E² (p = 0.5 if unknown).
- Halving the margin needs four times the sample.
- Divide by the response rate, and plan for each subgroup you will report.
Check yourself
Sources
- OpenIntro Statistics, 4th edition (Diez, Cetinkaya-Rundel, Barr), Section 6.1.4 Choosing a sample size when estimating a proportion https://www.openintro.org/book/os/
- NIST/SEMATECH e-Handbook, 7.2.2.2 Sample sizes required https://www.itl.nist.gov/div898/handbook/prc/section2/prc222.htm
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.