🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
Search courses…
💼 Servicesℹ️ About✉️ ContactView Pricing Plansfrom $10

Margin of Error — Precision and Sample Size

Foundations of StatisticsConfidence Intervals🟢 Free Lesson

Advertisement

Margin of Error — Precision and Sample Size

Foundations of Statistics

The Price of Precision

The margin of error quantifies the width of confidence intervals and depends on sample size, variability, and confidence level. Understanding this relationship is essential for designing efficient studies and interpreting reported results.

  • Survey Research — Determining how many respondents are needed for reliable estimates
  • Quality Control — Balancing precision requirements against inspection costs
  • Business Intelligence — Setting appropriate precision targets for data collection

The margin of error tells you exactly how much precision your budget can buy.


What Is Margin of Error?

DfMargin of Error

The margin of error quantifies the maximum expected difference between a sample statistic and the true population parameter at a given confidence level. It reflects the precision of an estimate — smaller margin of error means more precision.


Core Formula

Margin of Error for the Mean

E=zα/2σnE = z_{\alpha/2} \cdot \frac{\sigma}{\sqrt{n}}

Here,

  • EE=Margin of error
  • zα/2z_{\alpha/2}=Critical z-value for the desired confidence level
  • σ\sigma=Population standard deviation
  • nn=Sample size

When to Use t vs z

When σ\sigma is unknown and estimated by ss, replace zα/2z_{\alpha/2} with tα/2,n1t_{\alpha/2, n-1}. For large nn (n>30n > 30), the difference is negligible since tα/2,n1approxzα/2t_{\alpha/2, n-1} \\approx z_{\alpha/2} by convergence of the t-distribution.


Critical Values for Common Confidence Levels

ThRelationship Between Confidence Level and Critical Value

The margin of error scales linearly with the critical value, which grows sub-linearly with confidence level. Specifically:

Confidence Levelzα/2z_{\alpha/2}Relative Margin
90%1.6451.00
95%1.9601.19
99%2.5761.57

Increasing from 90% to 95% confidence increases the margin by 19%; increasing from 95% to 99% adds another 31%.

The Square Root Law

The margin of error decreases as 1/sqrtn1/\\sqrt{n}. To halve the margin of error, you need four times the sample size. This is the fundamental trade-off between precision and cost.


Derivation: Why E=zα/2σ/sqrtnE = z_{\alpha/2} \cdot \sigma / \\sqrt{n}?

ThMargin of Error from the Pivotal Quantity

Start with the pivotal quantity Z=Xˉmuσ/sqrtnsimN(0,1)Z = \frac{\bar{X} - \\mu}{\sigma/\\sqrt{n}} \\sim \mathcal{N}(0,1). The probability statement

P(zα/2Xˉμσ/nzα/2)=1αP\left(-z_{\alpha/2} \leq \frac{\bar{X} - \mu}{\sigma/\sqrt{n}} \leq z_{\alpha/2}\right) = 1 - \alpha

rearranges to:

P(Xˉzα/2σnμXˉ+zα/2σn)=1αP\left(\bar{X} - z_{\alpha/2}\frac{\sigma}{\sqrt{n}} \leq \mu \leq \bar{X} + z_{\alpha/2}\frac{\sigma}{\sqrt{n}}\right) = 1 - \alpha

The half-width of this interval is E=zα/2σ/sqrtnE = z_{\alpha/2}\sigma/\\sqrt{n}.


Worked Example: Polling

A pollster surveys 1,200 voters and finds 58% support Candidate A. The 95% margin of error is:

E=1.96×0.58×0.421200=1.96×0.000203=1.96×0.01425=0.0279E = 1.96 \times \sqrt{\frac{0.58 \times 0.42}{1200}} = 1.96 \times \sqrt{0.000203} = 1.96 \times 0.01425 = 0.0279

So the 95% CI is [0.552,0.608][0.552, 0.608] — Candidate A leads by 3 to 9 percentage points.

Design Effect in Complex Surveys

The formula above assumes simple random sampling. In stratified or cluster samples, the design effect DD inflates the margin: Eactual=zα/2sqrtp(1p)D/nE_{\text{actual}} = z_{\alpha/2}\\sqrt{p(1-p) \cdot D / n}. For typical cluster samples, DD ranges from 1.5 to 3.


The Three Factors Affecting Margin of Error

Factors Affecting $E$

  1. Sample size nn: Epropto1/sqrtnE \\propto 1/\\sqrt{n}. Doubling nn reduces EE by factor sqrt2approx1.41\\sqrt{2} \\approx 1.41.
  2. Population variability σ\sigma: EproptoσE \\propto \sigma. More variable data requires larger samples for the same precision.
  3. Confidence level: Eproptozα/2E \\propto z_{\alpha/2}. Higher confidence requires wider intervals.
  4. Population proportion pp (for proportions): E=zα/2sqrtp(1p)/nE = z_{\alpha/2}\\sqrt{p(1-p)/n} is maximized at p=0.5p = 0.5, giving Emax=zα/2/(2sqrtn)E_{\max} = z_{\alpha/2}/(2\\sqrt{n}).

Python Implementation

import numpy as np
from scipy import stats

def margin_of_error_mean(sigma, n, confidence=0.95):
    """Compute margin of error for population mean (σ known)."""
    z_crit = stats.norm.ppf(1 - (1 - confidence) / 2)
    return z_crit * sigma / np.sqrt(n)

def margin_of_error_proportion(p_hat, n, confidence=0.95):
    """Compute margin of error for population proportion."""
    z_crit = stats.norm.ppf(1 - (1 - confidence) / 2)
    return z_crit * np.sqrt(p_hat * (1 - p_hat) / n)

# Example 1: Mean with known σ
print(f"E (95%, σ=10, n=100): {margin_of_error_mean(10, 100, 0.95):.3f}")
print(f"E (99%, σ=10, n=100): {margin_of_error_mean(10, 100, 0.99):.3f}")

# Example 2: Proportion
print(f"E (95%, p̂=0.58, n=1200): {margin_of_error_proportion(0.58, 1200, 0.95):.4f}")

# Show 1/√n scaling
for n in [100, 400, 1600, 6400]:
    E = margin_of_error_mean(10, n, 0.95)
    print(f"n={n:5d}: E = {E:.3f}")

Key Takeaways

Summary: Margin of Error

  • E=zα/2σ/sqrtnE = z_{\alpha/2}\sigma/\\sqrt{n}: the half-width of the confidence interval
  • Scales as 1/sqrtn1/\\sqrt{n}: quadruple nn to halve EE
  • Scales linearly with σ\sigma: more variable data needs more data
  • For proportions, maximized at p=0.5p = 0.5: use p=0.5p = 0.5 as a conservative estimate when planning studies
  • Always distinguish between the margin of error (half-width) and the confidence interval (point estimate ±\pm margin)

Premium Content

Margin of Error — Precision and Sample Size

Unlock this lesson and 900+ advanced tutorials with a Premium plan.

🎯End-to-end Projects
💼Interview Prep
📜Certificates
🤝Community Access

Already a member? Log in

Need Expert Statistics Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement