Before the method: the idea behind it

How much can you promise?

An interval is only useful if it is narrow enough to say something. “Support is between 10% and 90%, with 99% confidence” is technically true and completely worthless. This final lesson is about the quantity that controls that width, what you can do to shrink it, and what you must give up in exchange.

Three levers, and only one you really control

The margin of error is the amount added and subtracted from the point estimate.

\[ E=z\sqrt{\frac{\hat{p}(1-\hat{p})}{n}} \]

Three quantities appear, and looking at where each one sits in the formula tells you exactly what it does.

z (confidence)In the numerator, so raising confidence widens the interval.your choice
n (sample size)In the denominator under a root, so a larger sample narrows it, but only as √n.your choice, at a cost
p (the data)Widest when p is near 0.5, narrower towards 0 or 1.not your choice

The third is decided by the population, not by you. So in practice there are two levers: how confident you want to be, and how many people you are willing to survey. Everything about designing a study comes down to trading those two against each other.

The trade-off you cannot escape

More confidence means a wider interval. That is not a flaw in the method; it is what confidence means.

To be more certain of capturing p you must cast a wider net. The only way to have both high confidence and a narrow interval is to increase n, which costs money. Move the sliders and watch the interval respond.

the interval, drawn to scale on a 0 to 1 axis
Confidence: 95%, z = 1.960
n = 400
Margin of error: 0.0490
Interval: (0.451, 0.549)

With p fixed at 0.5, only the confidence level and sample size change the width.

Two patterns are worth fixing in your mind. Going from 95% to 99% confidence widens the interval by about 31%, since 2.576 divided by 1.96 is roughly 1.31. And quadrupling n halves E, because of the square root. Neither is free: the first costs precision, the second costs money.

Rearranging the formula for n turns this into a design tool. Decide the margin of error you need, choose your confidence level, and solve.

\[ n=\frac{z^2\,\hat{p}(1-\hat{p})}{E^2} \]

Because n must be a whole number and a smaller sample would fail the requirement, you always round up here, even when the decimal part is tiny. That is different from recovering a sample size that was actually used, where you round to the nearest integer.

When you know nothing about p

Planning a survey creates a chicken-and-egg problem: the formula for n needs \(\hat{p}\), but you cannot know it until after you run the survey.

The way out is to prepare for the worst case. Since \(\hat{p}(1-\hat{p})\) is the only part involving the unknown, ask where that product is largest. The answer is a small piece of calculus you already know.

p(1 − p) p = 0.5 0 1
p = 0.50
p(1 − p) = 0.2500
Relative width: 100%

The product peaks at 0.25 when p is 0.5, and falls away in both directions.

You can prove it with the calculus from Term 1. Let \(f(p)=p-p^2\). Then \(f'(p)=1-2p\), which is zero at \(p=0.5\), and \(f”(p)=-2\lt0\), confirming a maximum. So the product is greatest, and therefore the margin of error is greatest, when the population is evenly split.

This gives the rule you need: if no value of p is given, use 0.5. It maximises E, so the sample size you calculate is guaranteed to be large enough whatever the true proportion turns out to be. Any other value would risk an undersized sample.

\[ \text{With } \hat{p}=0.5: \qquad n=\frac{z^2\times0.25}{E^2}=\left(\frac{z}{2E}\right)^2 \]

Seeing it in a simulation

The previous lesson showed that most, but not all, intervals contain p. Changing the confidence level changes how many miss.

Below you can build intervals at a chosen confidence level and watch the hit rate settle. At 90% roughly one interval in ten misses; at 99% only about one in a hundred does, but every interval is noticeably wider.

true p = 0.4
Built: 0
Contained p: 0
Hit rate: not yet
Typical width: not yet

Generate intervals, then switch levels and compare both the hit rate and the width.

Where this shows up in real life

Costing a survey

A market research firm quoting a job works backwards from the client’s required margin of error. Asking for 1% instead of 3% multiplies the sample size, and the price, by about nine. Clients routinely discover that precision is the expensive part.

Clinical trial size

Ethics committees require a sample size justification before approving a trial. Too few patients and the study cannot detect a real effect, wasting participants’ time and risk; too many exposes more people than necessary. This formula is where that number comes from.

What to reach for

The question asks for…Do this
the margin of errorE = z√(p(1−p)/n), or half the interval width
the sample size for a required En = z²p(1−p)/E², then round up
a sample size with no p givenUse p = 0.5, since it maximises E
the effect of raising the confidence levelLarger z, so wider interval, same data
the effect of a larger sampleE shrinks as 1/√n, so quadruple n to halve E
how many intervals contain pConfidence level times the number built

Next: the working method, twenty practice questions, ten harder ones, and the ClassPad guide. This is the last lesson of the course.