Sample Size Calculator Formula
Understand the math behind the sample size calculator. Each variable explained with a worked example.
Formulas Used
Sample Size (exact)
sample_size_raw = pow(z * sigma / moe, 2)Standard Error at This n
se_achieved = sigma / sqrt(pow(z * sigma / moe, 2))Variables
| Variable | Description | Default |
|---|---|---|
z | Z-Value (e.g., 1.96 for 95%) | 1.96 |
sigma | Population Standard Deviation | 15 |
moe | Desired Margin of Error | 3 |
How It Works
How to Calculate Required Sample Size
Formula
n = (z * sigma / E)^2
where E is the desired margin of error, z is the critical value for the confidence level, and sigma is the population standard deviation. Always round up to the next whole number since you cannot have a fractional observation.
Worked Example
You want a 95% CI with margin of error 3 and estimated SD 15. How many observations are needed?
z = 1.96sigma = 15moe = 3
- 01n = (z * sigma / E)^2
- 02n = (1.96 * 15 / 3)^2
- 03n = (9.8)^2
- 04n = 96.04
- 05Round up: n = 97 observations needed
Ready to run the numbers?
Open Sample Size Calculator