Lesson 6 of 7 · 16 min

Margin of error, confidence and sample size

See how the margin of error depends on the sample size and the confidence level, and choose the smallest sample that delivers a required margin of error.

What you will be able to do

  • Explain how the margin of error changes with the sample size nn and the confidence level.
  • Predict the new margin of error when nn is multiplied by a factor.
  • Find the minimum sample size for a required margin of error, with a prior estimate of pp or using p^=0.5\hat{p} = 0.5.

A polling company wants its next poll to be accurate to within 2 percentage points. How many people does it need to ring? Before answering, see how the margin of error behaves.

Interactive

Margin of error against sample size

The horizontal axis is the sample size nn. Increase zz (more confidence): the whole curve rises. Move p^\hat{p} away from 0.5: the curve falls.

Key idea

What controls the margin of error

E=zp^(1−p^)nE = z\sqrt{\frac{\hat{p}(1-\hat{p})}{n}}
  • Sample size: EE is proportional to 1n\frac{1}{\sqrt{n}}. Multiplying nn by kk divides EE by k\sqrt{k}, so four times the sample halves the margin.
  • Confidence level: a higher level needs a bigger zz, so a wider interval. Precision and confidence pull against each other for a fixed nn.
  • The proportion: p^(1−p^)\hat{p}(1-\hat{p}) is largest at p^=0.5\hat{p} = 0.5, so estimates near 50% have the biggest margins.
Margin of error at 95% confidence when p^=0.5\hat{p} = 0.5
nn100400100016002500
EE0.0980.0490.0310.02450.0196

A survey has a margin of error of 0.06. A second survey uses the same confidence level and gets the same p^\hat{p}, but has nine times the sample size. What is its margin of error?

Worked example

How big a sample halves the margin?

  • Simple familiar
  • Technology free

A survey of 500 people gave a 95% confidence interval for pp with a margin of error of 0.040. Assuming p^\hat{p} stays about the same, what sample size would give a margin of error of 0.020?

3 steps

Try it yourself first, then check the working one step at a time.

Method

  1. E∝1nE \propto \frac{1}{\sqrt{n}}.

  2. Dividing EE by kk needs k2k^2 times the sample size.

Watch out for

  • Doubling the sample to 1000, which only divides the margin by 2\sqrt{2}, to about 0.028.

Now turn the question round. You want EE to be at most some value. Solve zp^(1−p^)n≤Ez\sqrt{\frac{\hat{p}(1-\hat{p})}{n}} \le E for nn:

Minimum sample size
n≥(zE)2p^(1−p^)n \ge \left(\frac{z}{E}\right)^2 \hat{p}(1-\hat{p})

Tip

Which p̂ to use before you have data

You need p^\hat{p} before you have collected the sample. Use an estimate from a pilot study or a previous survey if you have one. If you have none, use p^=0.5\hat{p} = 0.5: it makes p^(1−p^)=0.25\hat{p}(1 - \hat{p}) = 0.25, its largest possible value, so the nn you get is enough whatever the true proportion is.

Why 0.5 gives the largest sample size

f(x)=x(1−x)=x−x2f(x) = x(1 - x) = x - x^2 has f′(x)=1−2x=0f'(x) = 1 - 2x = 0 at x=0.5x = 0.5, and f′′(x)=−2<0f''(x) = -2 < 0, so the maximum is f(0.5)=0.25f(0.5) = 0.25. Any other p^\hat{p} gives a smaller p^(1−p^)\hat{p}(1-\hat{p}) and so a smaller required nn.

Worked example

Choose a sample size for a required margin of error

  • Complex familiar
  • Technology active

A researcher wants to estimate the proportion of Queensland adults who have had skin cancer removed, to within 0.03 with 95% confidence.

(a) A pilot study suggests the proportion is about 0.2. Find the minimum sample size.

(b) Find the minimum sample size if there is no pilot estimate.

4 steps

Try it yourself first, then check the working one step at a time.

Method

  1. n≥(zE)2p^(1−p^)n \ge \left(\frac{z}{E}\right)^2\hat{p}(1-\hat{p}).

  2. Use a pilot p^\hat{p} if there is one; otherwise p^=0.5\hat{p} = 0.5.

  3. Round up.

Watch out for

  • Rounding 682.95 to 682, or 1067.11 to 1067.

  • Using the width (0.06) instead of the margin (0.03).

Find the smallest sample size that gives a margin of error of at most 0.05 for a 95% confidence interval when nothing is known about pp. Use z=1.96z = 1.96.

Common mistake

Rounding the sample size

Always round a minimum sample size up, even 864.36 → 865: rounding down gives a margin of error slightly bigger than required. And check whether the question gives the width of the interval: a width of 0.04 means E=0.02E = 0.02.

Summary

  • EE is proportional to 1n\frac{1}{\sqrt{n}}: multiplying nn by kk divides EE by k\sqrt{k}; four times the sample halves the margin.

  • For fixed nn, higher confidence means bigger zz and a wider interval.

  • The minimum sample size is n≥(zE)2p^(1−p^)n \ge \left(\frac{z}{E}\right)^2\hat{p}(1-\hat{p}), rounded up.

  • With no prior estimate use p^=0.5\hat{p} = 0.5, which gives the largest (safest) nn.

Finished the lesson?

Try the 2 quick checks above and the lesson completes itself, or mark it complete now.

Lesson 6 of 70% read

Save your progress with a free account