Sampling Error Calculator Formula

Understand the math behind the sampling error calculator. Each variable explained with a worked example.

Formulas Used

Sampling Error

sampling_error = z * sqrt(p * (1 - p) / n)

Sampling Error (%)

error_pct = z * sqrt(p * (1 - p) / n) * 100

Standard Error of Proportion

se_prop = sqrt(p * (1 - p) / n)

Lower CI

lower_ci = p - z * sqrt(p * (1 - p) / n)

Upper CI

upper_ci = p + z * sqrt(p * (1 - p) / n)

Variables

VariableDescriptionDefault
pProportion (p)0.5
nSample Size400
zZ-Value (e.g., 1.96 for 95%)1.96

How It Works

How to Calculate Sampling Error for Proportions

Formula

Sampling Error = z * sqrt(p * (1-p) / n)

Sampling error is the margin of error in estimating a population proportion from a sample. It depends on the confidence level (z), the proportion (p), and the sample size (n). Maximum error occurs at p = 0.5. The confidence interval is p +/- sampling error.

Worked Example

A poll of 400 people finds 50% support (p = 0.5) at 95% confidence.

p = 0.5n = 400z = 1.96
  1. 01SE = sqrt(0.5 * 0.5 / 400) = sqrt(0.000625) = 0.025
  2. 02Sampling error = 1.96 * 0.025 = 0.049
  3. 03As a percentage: +/- 4.9%
  4. 04CI: (0.451, 0.549) or 45.1% to 54.9%

Frequently Asked Questions

Why is sampling error maximized at p = 0.5?

The expression p*(1-p) is largest when p = 0.5 (it equals 0.25). As p moves toward 0 or 1, uncertainty decreases because the outcome is more predictable. Using p = 0.5 gives the most conservative (largest) margin of error.

How do I reduce sampling error?

Increase sample size (most effective), accept a lower confidence level (reduce z), or use stratified sampling. Quadrupling n halves the sampling error.

Does sampling error account for all sources of error?

No. Sampling error only covers random sampling variation. Non-sampling errors (bias, non-response, measurement error, question wording) are separate and often more problematic. A large sample does not fix non-sampling errors.

Ready to run the numbers?

Open Sampling Error Calculator