Skip to main content
Back to module
Statistics Fundamentals · From Sample to Population

Confidence intervals

Reading41mLesson 2 of 3 in this module

Compute a 95% confidence interval for a mean and interpret it correctly.

Why this matters

A sample mean is a single best guess, and it will almost never equal the true population mean exactly. A confidence interval adds an honest range: "the mean fill volume is 501.2 mL, give or take 0.8 mL". Reports, lab certificates, polls ("±3 percentage points") and engineering test results all use intervals. Knowing how to build one, and how to read one without overclaiming, is core statistical literacy.

The idea: estimate ± margin of error

confidence interval = estimate ± margin of error

The margin of error depends on two things: how much the estimate would vary from sample to sample (its standard error), and how confident you want to be (a critical value).

Standard error of the mean

If you took many random samples of size n and computed each mean, those means would themselves form a distribution. Its spread is the standard error (SE):

SE = sd / sqrt(n)

where sd is the sample standard deviation. Two things to notice:

  • More variable data (bigger sd) gives a bigger SE.
  • Bigger samples give a smaller SE, but only with the square root: to halve the SE you need four times the data.

A key fact, the central limit theorem, says the distribution of sample means is approximately normal for reasonably large n (a common rule of thumb is 30 or more), even when the data itself is not normal. That is why the normal curve from the last module shows up here.

The 95% interval

For a normal distribution, 95% of the area lies within 1.96 SDs of the centre. So:

95% CI = mean ± 1.96 * sd / sqrt(n)

Other levels use other critical values: 1.645 for 90%, 2.576 for 99%. Higher confidence means a wider interval.

Worked example

A bottling line samples 36 bottles. Mean fill = 501.2 mL, sample SD = 2.4 mL.

SE     = 2.4 / sqrt(36) = 2.4 / 6 = 0.4 mL
margin = 1.96 * 0.4 = 0.784 mL
95% CI = 501.2 ± 0.78  ->  (500.42, 501.98) mL

The whole interval is above 500 mL, so the data supports the claim that the line fills at least the labelled 500 mL on average.

Small samples and the t distribution

When n is small, using 1.96 makes the interval too narrow, because the sample SD is itself an uncertain estimate. The fix is the t distribution, which has fatter tails and a critical value that depends on n − 1 ("degrees of freedom"). For n = 10, the 95% value is about 2.26 instead of 1.96. Spreadsheets (T.INV.2T) and libraries such as SciPy provide it; the later course Probability & Statistical Inference uses it in depth. For n of 30 or more the difference is small, which is why this lesson uses 1.96.

What "95% confident" means

This is the part people get wrong. The true mean is a fixed number; it is either in your interval or not. "95%" describes the method: if you repeated the whole sampling process many times and built an interval each time, about 95% of those intervals would contain the true mean.

Correct: "We are 95% confident the true mean fill volume is between 500.4 and 502.0 mL."

Incorrect:

  • "95% of bottles are between 500.4 and 502.0 mL." The interval is about the mean, not individual bottles. Individual fills vary much more (SD 2.4 mL).
  • "There is a 95% chance the true mean is in this particular interval." Close, and common in casual speech, but strictly the probability statement is about the procedure.

Margin of error for proportions

For a proportion (share of yes answers, defect rate) the same pattern applies:

SE = sqrt(p * (1 - p) / n)

A poll of 1,000 people with p = 0.5 has SE ≈ 0.0158 and margin 1.96 × 0.0158 ≈ 0.031: the familiar "±3 points".

Common mistakes

  • Reading the interval as the range of individual values.
  • Forgetting that the margin covers only random sampling error. A biased sample can produce a narrow, confident, wrong interval.
  • Using 1.96 with very small samples instead of a t value.
  • Using the SD where the SE belongs (forgetting to divide by sqrt(n)).

Quick recap

  • CI = estimate ± critical value × standard error.
  • SE of a mean = sd / sqrt(n); four times the data halves it.
  • 95% uses 1.96 for large samples; small samples need t.
  • "95% confident" describes how often the method captures the true value.

Try it

In the Do tab, write the margin of error formula and build an interval for the bottling data.

Also in this lesson: