Sample Size for Estimating a Mean
What You'll Learn
You'll learn how to calculate the minimum sample size needed to estimate a population mean with a desired level of precision and confidence.
Why Sample Size Matters
Imagine you're planning a survey to estimate the average time users spend on your website. How many users do you need to sample? Too few, and your estimate will be imprecise. Too many, and you're wasting resources. The good news: there's a formula that tells you exactly how many observations you need.
The Formula
To determine the required sample size for estimating a mean, you need three inputs:
- Desired margin of error (E) – How close you want to be to the true mean
- Confidence level – Determines your critical value (z* or t*)
- Population standard deviation (σ) – Variability in the population
The formula is:
n = (z × σ / E)²*
Where:
n= required sample sizez*= critical value from the standard normal distribution (e.g., 1.96 for 95% confidence)σ= population standard deviationE= desired margin of error
Example Walkthrough
Suppose you want to estimate average website session time with:
- Margin of error: ±2 minutes
- Confidence level: 95% (z* = 1.96)
- Known population σ: 10 minutes
n = (1.96 × 10 / 2)² = (9.8)² = 96.04
You'd need at least 97 users in your sample (always round up).
Important Notes
- If σ is unknown, use a pilot study estimate or sample standard deviation (s)
- Larger variability requires larger samples
- Smaller margins of error require dramatically larger samples (the effect is squared!)
Key Takeaway: The required sample size for estimating a mean depends on how precise you want to be (margin of error), how confident you want to be (confidence level), and how variable your population is (standard deviation).