A Confidence Interval for a Mean
Every "average \pm margin" you have ever seen reported — average
household income, average blood pressure in a trial, the average weight of a factory's cereal boxes
— is built by one calculation. This is that calculation, assembled from parts you already have.
The move is simple: take a sample, compute its
mean, work out its
standard error, and
wrap the mean in a margin to get a
confidence interval
for the true population mean \mu. It is the workhorse of applied
statistics — learn it once and you will see it everywhere.
The recipe
Centre the interval on the sample mean, then reach out by a multiple of the standard error:
\bar{x} \pm z^{\*}\cdot \mathrm{SE}, \qquad \mathrm{SE} = \frac{\sigma}{\sqrt{n}}.
The half-width z^{\*}\cdot\mathrm{SE} is the margin of
error. The multiplier comes from the standard normal — courtesy of the
central limit theorem,
which makes \bar{x} approximately normal — read off as a
z-score.
For 95\% confidence, z^{\*} \approx 1.96; for
99\%, z^{\*} \approx 2.58.
One fork in the road. If the population spread \sigma is
known (or n is large), use the normal's
z^{\*}. If \sigma is unknown
and you must estimate it with the sample SD s from a small
sample, swap z^{\*} for the slightly larger critical value of
Student's t-distribution — the same machinery that powers
the t-test.
Worked example: cereal boxes, step by step
A factory samples n = 100 cereal boxes. The sample mean weight is
\bar{x} = 500\text{ g} and the sample SD is
s = 20\text{ g}. Build a 95\% confidence
interval for the true mean weight.
- Standard error:
\mathrm{SE} = \dfrac{s}{\sqrt{n}} = \dfrac{20}{\sqrt{100}} = \dfrac{20}{10} = 2\text{ g}.
- Critical value: 95\% confidence, large sample, so
z^{\*} \approx 1.96.
- Margin of error:
1.96 \times 2 = 3.92\text{ g}.
- The interval:
500 \pm 3.92 = [496.08,\ 503.92]\text{ g}.
In plain English: we are 95% confident that the true mean weight of all boxes lies between
about 496 g and 504 g — meaning the procedure we used lands an interval around the real mean
95% of the time. If the label promises 500 g, the factory is comfortably on target.
Worked example: same data, tighter or looser
Keep \bar{x} = 500 and s = 20, and watch two
dials move the interval.
- Demand 99% confidence (same n = 100):
z^{\*} rises to 2.58, so the margin grows to
2.58 \times 2 = 5.16 and the interval widens to
[494.84,\ 505.16]. More certainty, more hedging.
- Collect four times the data (n = 400, back at
95\%): \mathrm{SE} = 20/\sqrt{400} = 1, the
margin halves to 1.96, and the interval tightens to
[498.04,\ 501.96].
Note the \sqrt{n}: quadrupling the sample only halved the
margin. Precision is real but expensive.
Reading one in the wild
Once you know the shape, you can decode any reported interval on sight. A clinical trial announces:
"the drug lowered blood pressure by 8.0 mmHg on average (95% CI: 5.6 to 10.4)." Unpack it:
- The centre is the estimate: \bar{x} = 8.0 mmHg.
- The half-width is the margin of error:
(10.4 - 5.6)/2 = 2.4 mmHg.
- The interval misses zero entirely — the whole range is positive — so the drug's
effect is convincingly more than nothing. (An interval straddling
0 would leave "no real effect" on the table.)
That last reading — does the interval contain the boring value? — is the bridge from
confidence intervals to
hypothesis testing,
which asks the same question from the other direction.
Build the interval
The dot is the sample mean \bar{x}; the bracket spans
\bar{x} \pm z^{\*}\cdot\mathrm{SE} with \sigma
fixed. Slide n up and the bracket tightens; switch to higher confidence
and it stretches.
- The interval is \bar{x} \pm z^{\*}\cdot\dfrac{\sigma}{\sqrt{n}}, with margin of error z^{\*}\cdot\mathrm{SE}.
- z^{\*} \approx 1.96 for 95\%; z^{\*} \approx 2.58 for 99\% (and \approx 1.64 for 90\%).
- Use z when \sigma is known or n is large; use t when \sigma is estimated from a small sample.
- More confidence ⟶ larger critical value ⟶ wider; more data ⟶ larger n ⟶ narrower.
The formula \bar{x} \pm 1.96\cdot s/\sqrt{n} is only right when you
know \sigma or your sample is large. With a
small sample, you don't know the true spread — you estimated it with
s, and that estimate is itself uncertain. Pretending
s is exact makes your interval too narrow, so it
overstates your precision and quietly inflates your confidence.
The fix is the t-distribution. Its critical value is a bit larger than
z — for n = 5 at 95\%
it's about 2.78 instead of 1.96 — which widens
the interval to honestly account for the extra uncertainty in s. The
correction matters most when n is tiny and vanishes as
n grows: by n \approx 30 the t- and
z-values are nearly identical. Small sample, unknown \sigma? Reach for t.
The t-distribution owes its existence to beer. Around 1900, William Sealy Gosset
was a young chemist at the Guinness brewery in Dublin, wrestling with tiny samples
of barley and hops — just a handful of measurements, far too few for the big-sample theory of his
day. So he worked out the correct maths for small samples himself, and in doing so invented what we
now call the t-distribution.
There was one snag: Guinness forbade its employees from publishing, terrified that rivals would
learn its trade secrets. So Gosset published his 1908 paper under a modest pseudonym —
"Student" — and the name stuck forever. To this day it is Student's
t-distribution, one of the great pseudonyms in the history of science, and a reminder that some of
the sturdiest tools in statistics were forged to check the consistency of a pint.
See it explained