Margin of Error Calculator

Compute the margin of error for a mean or a proportion, with critical values and every step shown
Margin of error for p-hat = 0.52, n = 1000 at 95% confidence
Margin of error for a mean with sigma = 12, n = 64, 95% confidence
Margin of error for a mean with s = 8, n = 25, 99% confidence
Sample size needed for a 3% margin of error at 95% confidence

The Margin of Error Formula

The margin of error EE is the half-width of a confidence interval — how far a sample estimate can plausibly sit from the true population parameter.

Mean, population σ\sigma known:

E=zσnE = z^* \cdot \frac{\sigma}{\sqrt{n}}

Mean, σ\sigma unknown (the usual case):

E=tn1snE = t^*_{n-1} \cdot \frac{s}{\sqrt{n}}

Proportion:

E=zp^(1p^)nE = z^* \sqrt{\frac{\hat{p}(1 - \hat{p})}{n}}

Symbols: nn is the sample size, σ\sigma the population standard deviation, ss the sample standard deviation, p^\hat{p} the sample proportion, and zz^* or tt^* the critical value for the chosen confidence level.

The interval is then estimate±E\text{estimate} \pm E. Because EE shrinks like 1/n1/\sqrt{n}, quadrupling the sample only halves the margin of error.

Critical Values, Standard Error, and Sample Size

Critical values

Confidencezz^*
90%1.6451.645
95%1.961.96
99%2.5762.576

Use zz^* when σ\sigma is known; use tt^* with df=n1df = n - 1 whenever you estimate the spread from the sample with ss. At 99% confidence with n=25n = 25, t24=2.797t^*_{24} = 2.797 — noticeably wider than z=2.576z^* = 2.576, which is exactly the penalty for not knowing σ\sigma.

Standard error vs margin of error

The standard error is σ/n\sigma/\sqrt{n} (or p^(1p^)/n\sqrt{\hat{p}(1-\hat{p})/n}). The margin of error is that standard error multiplied by the critical value. They are different numbers, and only the second one carries a confidence level.

Sample size for a target margin

Solve for nn:

n=(zσE)2n=p^(1p^)(zE)2n = \left(\frac{z^*\sigma}{E}\right)^2 \qquad\qquad n = \hat{p}(1-\hat{p})\left(\frac{z^*}{E}\right)^2

With no prior estimate of p^\hat{p}, use 0.50.5 — it maximises p^(1p^)\hat{p}(1-\hat{p}) and so is the safe choice. Always round nn up.

Conditions and Common Mistakes

These formulas are valid only when:

  • Random sampling: the data come from a simple random sample or a randomised experiment. Margin of error quantifies sampling variability only — it says nothing about bias from non-response, bad question wording, or a self-selected panel.
  • Independence: observations are independent. When sampling without replacement, keep n10%n \le 10\% of the population.
  • Approximate normality: for a mean, either the population is roughly normal or n30n \ge 30 so the Central Limit Theorem applies. For a proportion, check np^10n\hat{p} \ge 10 and n(1p^)10n(1-\hat{p}) \ge 10.

Frequent errors

  • Using zz^* when σ\sigma is unknown and nn is small — that understates EE; use tt^*.
  • Dividing by nn instead of n\sqrt{n}.
  • Grabbing the one-tailed critical value: a two-sided 95% interval uses 1.961.96, not 1.6451.645.
  • Assuming a larger population demands a larger sample. Population size is almost irrelevant; nn is what drives EE.

示例题目

Step 1: Check conditions: np^=52010n\hat{p} = 520 \ge 10 and n(1p^)=48010n(1-\hat{p}) = 480 \ge 10
Step 2: Standard error: 0.52×0.481000=0.0002496=0.01580\sqrt{\dfrac{0.52 \times 0.48}{1000}} = \sqrt{0.0002496} = 0.01580
Step 3: Critical value for 95%: z=1.96z^* = 1.96
Step 4: E=1.96×0.01580=0.03097E = 1.96 \times 0.01580 = 0.03097
Step 5: Interval: 0.52±0.031=(0.489, 0.551)0.52 \pm 0.031 = (0.489,\ 0.551)
Answer: E0.031E \approx 0.031, i.e. about ±3.1\pm 3.1 percentage points

Step 1: σ\sigma is unknown, so use tt^* with df=n1=24df = n - 1 = 24
Step 2: For 99% two-sided, t24=2.797t^*_{24} = 2.797
Step 3: Standard error: s/n=8/25=8/5=1.6s/\sqrt{n} = 8/\sqrt{25} = 8/5 = 1.6
Step 4: E=2.797×1.6=4.4752E = 2.797 \times 1.6 = 4.4752
Answer: E4.48E \approx 4.48

Step 1: No prior estimate, so take the conservative p^=0.5\hat{p} = 0.5, giving p^(1p^)=0.25\hat{p}(1-\hat{p}) = 0.25
Step 2: n=0.25(1.960.03)2n = 0.25 \left(\dfrac{1.96}{0.03}\right)^2
Step 3: 1.96/0.03=65.331.96/0.03 = 65.3\overline{3}, and 65.332=4268.4465.3\overline{3}^2 = 4268.44
Step 4: n=0.25×4268.44=1067.11n = 0.25 \times 4268.44 = 1067.11
Step 5: Round up — a fractional respondent is not available
Answer: n=1068n = 1068

常见问题

The standard error measures how much a sample estimate varies from sample to sample. The margin of error is the standard error multiplied by a critical value (z* or t*), which attaches a confidence level to it. For a 95% interval the margin of error is roughly twice the standard error.

Use t* with df = n − 1 whenever you estimate the spread from the sample standard deviation s, which is nearly always the case with real data. Use z* only when the population σ is genuinely known. For n ≥ 30 the two critical values are close, but t* is never wrong.

There is no universal threshold — it depends on the decision. National opinion polls typically report ±3%, market research often accepts ±5%, and clinical work may demand ±1% or better. Pick the largest error you could tolerate and still act the same way, then solve for the sample size that delivers it.

Essentially no. The formula depends on n, not on population size, so a sample of 1000 gives roughly ±3% whether the population is 100,000 or 300 million. A finite-population correction matters only when your sample exceeds about 10% of the population.

相关求解器

相关学习指南

免费试用 AI-Math

任何数学问题都能获得分步解答。拍照上传或输入问题即可。

开始解题