StatisticsConfidence Intervals3 of 6
Confidence Intervals · 3

Margin of Error and Sample Size

When we estimate a population value from a single random sample, we need a way to measure how far off our sample might be and how confident we can be in that range.

1

Confidence Level and the Margin of Error Tradeoff

To build a confidence interval around a sample proportion, we start from the spread of random samples around the truth and choose how many steps wide our interval needs to be.

Remember, when we take random samples to answer a Yes/No question, sample proportions stack up in a normal bell curve around the true population proportion. The spread of that pile, one standard error (or 1 Typical Miss\spread{\text{1 Typical Miss}}), depends on how divided the crowd is and how many people we ask:

1 Typical Miss\displaystyle \spread{\text{1 Typical Miss}} =Yes×No⏟p(1−p)People⏟n\displaystyle = \sqrt{\frac{\underbrace{\stat{\text{Yes}} \times \nos{\text{No}}}_{\stat{p}\nos{(1 - p)}}}{\underbrace{\text{People}}_{n}}}

Why does a poll report both a confidence level and a margin of error, and why did the news poll ask 1,0681,068 people?

Confidence Level and the Margin of Error Tradeoff
57% support the new\htmlClass{lc-blue}{57\%}\text{ support the new}
four-day workweek\text{four-day workweek}
Margin of error:\text{Margin of error:}
±3%\htmlClass{lc-pink}{\pm 3\%}
Confidence level:\text{Confidence level:}
95%\htmlClass{lc-green}{95\%}
Sample size:\text{Sample size:}
1,068 people1{,}068\text{ people}
The Truth\htmlClass{lc-violet}{\text{The Truth}}
1 Typical Miss\htmlClass{lc-pink}{\text{1 Typical Miss}}
68%\htmlClass{lc-green}{68\%}
z∗=1z^* = 1
95%\htmlClass{lc-green}{95\%}
z∗=1.96z^* = 1.96
99%\htmlClass{lc-green}{99\%}
z∗=2.58z^* = 2.58

To build a confidence interval from a single sample, we multiply 1 Typical Miss\spread{\text{1 Typical Miss}} by the number of steps z∗z^* for our chosen confidence level, and go that distance to the left and right of our sample estimate:

Estimate±Margin of Error,Margin of Error=(Steps for yourConfidence z∗)×(1 Typical Miss)\displaystyle \begin{gathered} \stat{\text{Estimate}} \pm \spread{\text{Margin of Error}}, \\ \begin{aligned} \spread{\text{Margin of Error}} &= (\text{Steps for your} \\ &\qquad \text{Confidence } z^*) \\ &\quad \times (\spread{\text{1 Typical Miss}}) \end{aligned} \end{gathered}

For quick mental checks, 95%\share{95\%} confidence is about 22 steps (z∗≈2z^* \approx 2), though you will usually use the exact normal-curve steps: z∗=1z^* = 1 for 68%\share{68\%} confidence, z∗=1.96z^* = 1.96 for 95%\share{95\%} confidence, and z∗=2.58z^* = 2.58 for 99%\share{99\%} confidence.

Here is how those steps work on the 100100-person poll at 57%\stat{57\%} support with a roughly 50/50\stat{50}/\nos{50} split.

Text solution
Find 1 Typical Miss from the split and sample size
1 Typical Miss\displaystyle \spread{\text{1 Typical Miss}} =0.50×0.50100\displaystyle = \sqrt{\frac{\stat{0.50} \times \nos{0.50}}{100}} =0.25100\displaystyle = \sqrt{\frac{0.25}{100}} =0.05\displaystyle = \spread{0.05} =5%\displaystyle = \spread{5\%}
Multiply 1 Typical Miss by the steps for 95% confidence
Margin of Error=2×5%=10%(or 1.96×5%=9.8%using exact steps)\displaystyle \begin{aligned} \spread{\text{Margin of Error}} = 2 \times \spread{5\%} &= \spread{10\%} \\ (\text{or } 1.96 \times \spread{5\%} &= \spread{9.8\%} \\ \text{using exact steps}) & \end{aligned}
Add and subtract the Margin of Error around the sample estimate
57%±10%\displaystyle \stat{57\%} \pm \spread{10\%} =47% to 67%\displaystyle = 47\% \text{ to } 67\%

So at 95%\share{95\%} confidence, true support for the four-day workweek is somewhere between 47%47\% and 67%67\%, which is too wide to tell whether a majority supports it.

With the same 100100 people, a narrower interval catches the truth less often, and higher confidence takes a wider interval.

With the same 100 people polled, making the interval narrower around 57% makes it less likely to catch the true percentage, while catching it more often takes a wider interval.
2

Choosing a Sample Size for a Proportion

Before running a poll, we can work backward from a target Margin of Error and confidence level to find how many people we need to ask.

We don't need a new formula to find the sample size. We use the same Margin of Error equation, plug in the worst-case 50/50\stat{50}/\nos{50} split (Yes×No=0.25\stat{\text{Yes}} \times \nos{\text{No}} = 0.25) if we have no earlier estimate of the split, and solve for People\text{People}.

Choosing a Sample Size for a Proportion
Confidence level=95%Margin of Error≤3%People=  ?\displaystyle \begin{aligned} \text{Confidence level} &= \share{95\%} \\ \spread{\text{Margin of Error}} &\le \spread{3\%} \\ \text{People} &= \;? \end{aligned}

Here is how we find the sample size needed for a Margin of Error of at most ±3%\pm \spread{3\%} (0.03\spread{0.03}) at 95%\share{95\%} confidence (z∗=1.96z^* = 1.96) when no earlier poll exists.

Text solution
Divide the target Margin of Error by the confidence steps z∗z^* to find the target Typical Miss
1 Typical Miss\displaystyle \spread{\text{1 Typical Miss}} =0.031.96≈0.015306\displaystyle = \frac{\spread{0.03}}{1.96} \approx \spread{0.015306}
Set the Typical Miss formula with a worst-case 50/50 split equal to that target
0.25People\displaystyle \sqrt{\frac{0.25}{\text{People}}} =0.031.96\displaystyle = \frac{\spread{0.03}}{1.96}
Square both sides to undo the square root and solve for People
0.25People=(0.031.96)2≈0.00023428  ⟹  People=0.250.00023428≈1,067.11\displaystyle \begin{aligned} \frac{0.25}{\text{People}} &= \left(\frac{\spread{0.03}}{1.96}\right)^2 \\ &\approx 0.00023428 \\ \implies \text{People} &= \frac{0.25}{0.00023428} \\ &\approx 1,067.11 \end{aligned}
Round UP to the next whole person so the Margin of Error stays at or under 3%
1,067.11→1,068 people\displaystyle 1,067.11 \rightarrow 1,068\text{ people}

So we must poll 1,0681,068 people to guarantee a Margin of Error no wider than ±3%\pm \spread{3\%} at 95%\share{95\%} confidence, no matter what the true split turns out to be.

Shrinking the Margin of Error takes a much larger poll: cutting the error in half (from ±10%\pm \spread{10\%} to ±5%\pm \spread{5\%}) takes 44 times as many people (100100 to 400400), and cutting it to a third (from ±3%\pm \spread{3\%} to ±1%\pm \spread{1\%}) takes 99 times as many (1,0681,068 to 9,6049,604).

At 95% confidence, shrinking the margin of error multiplies the needed sample size by the square of how many times smaller you make it.
3

Margin of Error and Sample Size for a Mean

Now suppose we are estimating an average (a mean), such as average commute time in minutes, instead of a Yes/No proportion.

The Margin of Error method stays the same. The only piece that changes is 1 Typical Miss\spread{\text{1 Typical Miss}}, which now uses the standard deviation of individual measurements, σ\spread{\sigma}, in place of Yes×No\sqrt{\stat{\text{Yes}} \times \nos{\text{No}}}:

1 Typical Miss\displaystyle \spread{\text{1 Typical Miss}} =σPeople\displaystyle = \frac{\spread{\sigma}}{\sqrt{\text{People}}}
Margin of Error and Sample Size for a Mean
Margin of Error\htmlClass{lc-pink}{\text{Margin of Error}}
=z∗×1 Typical Miss= z^* \times \htmlClass{lc-pink}{\text{1 Typical Miss}}
1 Typical Miss\htmlClass{lc-pink}{\text{1 Typical Miss}}
=Yes×NoPeople= \sqrt{\dfrac{\htmlClass{lc-blue}{\text{Yes}} \times \htmlClass{lc-orange}{\text{No}}}{\text{People}}}
0\htmlClass{lc-mute}{0}
10\htmlClass{lc-mute}{10}
20\htmlClass{lc-mute}{20}
30\htmlClass{lc-mute}{30}
40\htmlClass{lc-mute}{40}
50\htmlClass{lc-mute}{50}
60\htmlClass{lc-mute}{60}
70\htmlClass{lc-mute}{70}
80\htmlClass{lc-mute}{80}
90\htmlClass{lc-mute}{90}
minutes\htmlClass{lc-mute}{\text{minutes}}

Here are the steps for city commute times with an individual standard deviation of σ=15 minutes\spread{\sigma} = \spread{15}\text{ minutes} at 95%\share{95\%} confidence (z∗=1.96z^* = 1.96): first finding the Margin of Error for 100100 commuters, and then finding how many commuters are needed to shrink that Margin of Error to ±1 minute\pm \spread{1}\text{ minute}.

Text solution
Divide σ\spread{\sigma} by People\sqrt{\text{People}} and multiply by z∗z^* to find the Margin of Error for 100 commuters
1 Typical Miss=15100=1.5 minutes  ⟹  Margin of Error=1.96×1.5=2.94 minutes\displaystyle \begin{aligned} \spread{\text{1 Typical Miss}} &= \frac{\spread{15}}{\sqrt{100}} \\ &= \spread{1.5}\text{ minutes} \\ \implies & \\ \spread{\text{Margin of Error}} &= 1.96 \times \spread{1.5} \\ &= \spread{2.94}\text{ minutes} \end{aligned}
Set σPeople\tfrac{\spread{\sigma}}{\sqrt{\text{People}}} equal to the new target Typical Miss (1 minute1.96\tfrac{\spread{1}\text{ minute}}{1.96}) and isolate People\sqrt{\text{People}}
15People=11.96  ⟹  People=15×1.96=29.4\displaystyle \begin{aligned} \frac{\spread{15}}{\sqrt{\text{People}}} &= \frac{\spread{1}}{1.96} \\ \implies \sqrt{\text{People}} &= \spread{15} \times 1.96 = 29.4 \end{aligned}
Square both sides and round UP to the next whole commuter
People\displaystyle \text{People} =29.42\displaystyle = 29.4^2 =864.36→865 commuters\displaystyle = 864.36 \rightarrow 865\text{ commuters}

So shrinking the Margin of Error from roughly 3 minutes\spread{3}\text{ minutes} down to 1 minute\spread{1}\text{ minute} (3\spread{3} times smaller) increases the needed sample from 100100 to 865865 commuters (nearly 32=93^2 = 9 times larger).

4

Population Size, Bias, and What Margin of Error Misses

Finally, does a much larger population need a larger sample size, and what polling mistakes can the Margin of Error not fix?

Population Size, Bias, and What Margin of Error Misses
50,00050{,}000
300 million\text{300 million}
1,0681{,}068
1,0681{,}068
The Truth\htmlClass{lc-violet}{\text{The Truth}}
60%\htmlClass{lc-violet}{60\%}
40%\htmlClass{lc-mute}{40\%}
50%\htmlClass{lc-mute}{50\%}
Unbiased Random Sample\text{Unbiased Random Sample}
Biased Sample\text{Biased Sample}
(Undercoverage, Nonresponse,\text{(Undercoverage, Nonresponse,}
or Wording)\text{or Wording)}
bias\htmlClass{lc-orange}{\text{bias}}
40%\htmlClass{lc-mute}{40\%}
48%\htmlClass{lc-blue}{48\%}
±3%\htmlClass{lc-pink}{\pm 3\%}

If a biased poll centers the sample results at 48%\stat{48\%} instead of the truth at 60%\truth{60\%}, polling 1,0001,000 or 10,00010,000 people just shrinks the interval tighter around 48%\stat{48\%} and still misses 60%\truth{60\%}.

On a biased poll, polling more people shrinks the margin of error tighter around the shifted center without moving it any closer to the truth.

Key concepts

Every Margin of Error problem uses the same core relationship:

Margin of Error\displaystyle \spread{\text{Margin of Error}} =(Confidence Steps z∗)×(1 Typical Miss)\displaystyle = (\text{Confidence Steps } z^*) \times (\spread{\text{1 Typical Miss}})

where z∗=1z^* = 1 for 68%\share{68\%} confidence, z∗=1.96z^* = 1.96 (about 22) for 95%\share{95\%} confidence, and z∗=2.58z^* = 2.58 for 99%\share{99\%} confidence.

Pick 1 Typical Miss\spread{\text{1 Typical Miss}} from what is being measured

  • Yes/No proportion: Use 1 Typical Miss=Yes×NoPeople\spread{\text{1 Typical Miss}} = \sqrt{\frac{\stat{\text{Yes}} \times \nos{\text{No}}}{\text{People}}} (for 100100 people at a 50/50\stat{50}/\nos{50} split, 0.25100=0.05=5%\sqrt{\tfrac{0.25}{100}} = \spread{0.05} = \spread{5\%}).
  • Average (mean): When given the individual standard deviation σ\spread{\sigma}, use 1 Typical Miss=σPeople\spread{\text{1 Typical Miss}} = \frac{\spread{\sigma}}{\sqrt{\text{People}}} (for σ=15 minutes\spread{\sigma} = \spread{15}\text{ minutes} and 100100 commuters, 15100=1.5 minutes\tfrac{\spread{15}}{\sqrt{100}} = \spread{1.5}\text{ minutes}).
Working backward to choose a sample size (People\text{People})

Divide the target Margin of Error by z∗z^* to get the target Typical Miss, square both sides to get People\text{People} out of the square root, and always round UP to the next whole person (1,067.11→1,0681,067.11 \rightarrow 1,068). For a proportion, use an earlier split if one is given (80/20→0.80×0.20=0.16\stat{80}/\nos{20} \rightarrow \stat{0.80} \times \nos{0.20} = 0.16), or the worst-case 50/50\stat{50}/\nos{50} split (0.50×0.50=0.25\stat{0.50} \times \nos{0.50} = 0.25) when you have no earlier estimate. Because People\text{People} is inside a square root, making the Margin of Error k\spread{k} times smaller multiplies the sample size by k2k^2 (half the error takes 44 times the people).

When Margin of Error does not apply

Never increase a sample size just because the total population is huge (a town of 50,00050,000 and a country of 300 million300\text{ million} both need 1,0681,068 people for ±3%\pm \spread{3\%}), and never use Margin of Error to trust a poll with undercoverage, nonresponse, or biased wording. Polling more people on a biased survey only shrinks the interval around the wrong answer.

5

Practice

1

A random sample of 400400 residents finds that 80%\stat{80\%} support building a new bike lane (an 80/20\stat{80}/\nos{20} split). Find 1 Typical Miss\spread{\text{1 Typical Miss}} and the 95%\share{95\%} confidence interval (z∗=1.96z^* = 1.96) for true support. Without polling more people, what happens to the Margin of Error if you raise the confidence level to 99%\share{99\%} (z∗=2.58z^* = 2.58)?

Multiply the 80/20\stat{80}/\nos{20} split as decimals (0.80×0.20\stat{0.80} \times \nos{0.20}) before dividing by 400400 and taking the square root.

Using the 80/20\stat{80}/\nos{20} split, Yes×No=0.80×0.20=0.16\stat{\text{Yes}} \times \nos{\text{No}} = \stat{0.80} \times \nos{0.20} = 0.16 (do not use 0.250.25 here, since we already have the sample split). Dividing by 400400 and taking the square root gives:
1 Typical Miss\displaystyle \spread{\text{1 Typical Miss}} =0.16400\displaystyle = \sqrt{\frac{0.16}{400}} =0.0004\displaystyle = \sqrt{0.0004} =0.02\displaystyle = \spread{0.02} =2%\displaystyle = \spread{2\%}
(Be careful not to forget the square root, which leaves 0.00040.0004, or 0.04%0.04\%, and gives an interval 5050 times too narrow.) At 95%\share{95\%} confidence:
Margin of Error=1.96×2%=3.92%  ⟹  80%±3.92%=76.08%to 83.92%\displaystyle \begin{aligned} \spread{\text{Margin of Error}} &= 1.96 \times \spread{2\%} \\ &= \spread{3.92\%} \\ \implies \stat{80\%} \pm \spread{3.92\%} &= 76.08\% \\ &\quad \text{to } 83.92\% \end{aligned}
Raising the confidence level to 99%\share{99\%} with the same 400400 people widens the Margin of Error to 2.58×2%=5.16%2.58 \times \spread{2\%} = \spread{5.16\%} (74.84%74.84\% to 85.16%85.16\%).
2

You are planning a poll on a brand-new ballot topic with no earlier estimate of how voters are split. How many people do you need to sample to be 95%\share{95\%} confident (z∗=1.96z^* = 1.96) that your Margin of Error is at most ±4%\pm \spread{4\%}?

What worst-case value of Yes×No\stat{\text{Yes}} \times \nos{\text{No}} guarantees your sample size will be large enough? Set 1 Typical Miss\spread{\text{1 Typical Miss}} equal to 0.041.96\tfrac{\spread{0.04}}{1.96}.

With no earlier estimate, use a worst-case 50/50\stat{50}/\nos{50} split (Yes×No=0.50×0.50=0.25\stat{\text{Yes}} \times \nos{\text{No}} = \stat{0.50} \times \nos{0.50} = 0.25):
0.25People\displaystyle \sqrt{\frac{0.25}{\text{People}}} =0.041.96\displaystyle = \frac{\spread{0.04}}{1.96}
Squaring both sides to undo the square root gives:
0.25People=(0.041.96)2  ⟹  People=0.25×(1.960.04)2=0.25×492=600.25\displaystyle \begin{aligned} \frac{0.25}{\text{People}} &= \left(\frac{\spread{0.04}}{1.96}\right)^2 \\ \implies \text{People} &= 0.25 \times \left(\frac{1.96}{\spread{0.04}}\right)^2 \\ &= 0.25 \times 49^2 = 600.25 \end{aligned}
Do not round .25.25 down to 600600, because 600600 people would push the Margin of Error slightly over 4%\spread{4\%} (to 4.0008%\spread{4.0008\%}). Always round UP to the next whole person: 601 people601\text{ people}.
3

An earlier survey found that roughly 90%\stat{90\%} of customers are satisfied with a city bus route (a 90/10\stat{90}/\nos{10} split). Using this earlier estimate, how many customers must you poll to get a Margin of Error of at most ±2%\pm \spread{2\%} at 99%\share{99\%} confidence (z∗=2.58z^* = 2.58)? Why is this fewer people than if you had no earlier estimate?

Use the 90/10\stat{90}/\nos{10} split in Yes×No\stat{\text{Yes}} \times \nos{\text{No}}, then set Yes×NoPeople\sqrt{\tfrac{\stat{\text{Yes}} \times \nos{\text{No}}}{\text{People}}} equal to 0.022.58\tfrac{\spread{0.02}}{2.58}.

Using the 90/10\stat{90}/\nos{10} split, Yes×No=0.90×0.10=0.09\stat{\text{Yes}} \times \nos{\text{No}} = \stat{0.90} \times \nos{0.10} = 0.09 (don't use the 50/50\stat{50}/\nos{50} split of 0.250.25 here, which would give a much larger sample of 4,1614,161 customers):
0.09People\displaystyle \sqrt{\frac{0.09}{\text{People}}} =0.022.58\displaystyle = \frac{\spread{0.02}}{2.58}
Squaring both sides gives:
People\displaystyle \text{People} =0.09×(2.580.02)2\displaystyle = 0.09 \times \left(\frac{2.58}{\spread{0.02}}\right)^2 =0.09×1292\displaystyle = 0.09 \times 129^2 =1,497.69→1,498 customers\displaystyle = 1,497.69 \rightarrow 1,498\text{ customers}
This takes far fewer people than the 50/50\stat{50}/\nos{50} worst-case (4,1614,161 customers) because a 90/10\stat{90}/\nos{10} crowd is much less divided (0.090.09 vs. 0.250.25), so sample results vary less.
4

A poll of 600600 people has a Margin of Error of ±4%\pm \spread{4\%}. At the same confidence level, how many people must be polled to shrink the Margin of Error to ±1%\pm \spread{1\%}? If the pollsters instead multiply their original sample size by 44 (to 2,4002,400 people), what happens to the Margin of Error?

How many times smaller is ±1%\pm \spread{1\%} than ±4%\pm \spread{4\%}, and what happens to that factor when People\text{People} sits inside a square root?

Shrinking the Margin of Error from ±4%\pm \spread{4\%} to ±1%\pm \spread{1\%} makes the error 4\spread{4} times smaller. Because People\text{People} is inside a square root, do not just multiply the sample size by 44 (to 2,4002,400 people); you need 42=164^2 = 16 times as many people:
600×16\displaystyle 600 \times 16 =9,600 people\displaystyle = 9,600\text{ people}
If the pollsters multiply the original sample size by 44 (to 2,4002,400 people), the Margin of Error is divided by 4=2\sqrt{4} = \spread{2} (not 44), cutting it in half from ±4%\pm \spread{4\%} to ±2%\pm \spread{2\%}.
5

Past shipping records show that the weights of checked bags have a standard deviation of σ=12 pounds\spread{\sigma} = \spread{12}\text{ pounds}. (a) In a random sample of 3636 bags, what is the Margin of Error for the average weight at 95%\share{95\%} confidence (z∗=1.96z^* = 1.96)? (b) How many bags must be weighed to be 95%\share{95\%} confident that the sample average is within 2 pounds\spread{2}\text{ pounds} of the true average weight?

We are estimating an average weight with a known σ\spread{\sigma}, so what expression replaces Yes×NoPeople\sqrt{\tfrac{\stat{\text{Yes}} \times \nos{\text{No}}}{\text{People}}} for 1 Typical Miss\spread{\text{1 Typical Miss}}?

(a) Divide σ=12\spread{\sigma} = \spread{12} by 36=6\sqrt{36} = 6 (be careful not to divide by 3636 without the square root, which would give a Margin of Error of 0.65 pounds0.65\text{ pounds}):
1 Typical Miss=1236=2 pounds  ⟹  Margin of Error=1.96×2=3.92 pounds\displaystyle \begin{aligned} \spread{\text{1 Typical Miss}} &= \frac{\spread{12}}{\sqrt{36}} \\ &= \spread{2}\text{ pounds} \\ \implies \spread{\text{Margin of Error}} &= 1.96 \times \spread{2} \\ &= \spread{3.92}\text{ pounds} \end{aligned}
(b) Set 1 Typical Miss\spread{\text{1 Typical Miss}} equal to the target Margin of Error divided by z∗z^*:
12Bags=21.96  ⟹  Bags=12×1.962=11.76\displaystyle \begin{aligned} \frac{\spread{12}}{\sqrt{\text{Bags}}} &= \frac{\spread{2}}{1.96} \\ \implies \sqrt{\text{Bags}} &= \frac{\spread{12} \times 1.96}{\spread{2}} = 11.76 \end{aligned}
Squaring both sides gives Bags=11.762=138.2976\text{Bags} = 11.76^2 = 138.2976. Even though .2976.2976 is less than 0.50.5, rounding down to 138138 would push the Margin of Error slightly over 2 pounds\spread{2}\text{ pounds}, so round UP to 139 bags139\text{ bags}.
6

A town of 40,00040,000 people and a country of 200 million200\text{ million} people both want a 95%\share{95\%} confidence poll with a ±3%\pm \spread{3\%} Margin of Error. (a) Does the country need a larger sample size than the town? (b) Suppose the town polls 10,00010,000 people (shrinking its calculated Margin of Error below ±1%\pm \spread{1\%}) by emailing a link that 88%88\% of recipients ignore, while asking, "Don't you agree that our neglected parks need more funding?" Does the ±1%\pm \spread{1\%} Margin of Error mean true town support is within 1%\spread{1\%} of the poll result?

Does total population size appear anywhere in the 1 Typical Miss\spread{\text{1 Typical Miss}} formula, and does a larger sample size fix a shifted pile of samples?

(a) No. Do not increase the sample size just because the country is 5,0005,000 times larger; like tasting a well-stirred pot of soup, only the size of the spoon (the sample size of 1,0681,068 people) matters, not the size of the pot. (b) No. Even though 10,00010,000 people is a quarter of the town and gives a calculated Margin of Error under ±1%\pm \spread{1\%}, the poll has nonresponse (88%88\% ignored it) and biased question wording, which shift the entire pile of samples away from the truth. Margin of Error only measures random sampling variation, so polling 10,00010,000 people just builds a tight ±1%\pm \spread{1\%} interval around the wrong answer.