← back to statistics

Confidence Intervals

Statistics through experiments · 8 of 16 · CC BY-SA 4.0

A single estimate is useful. Giving it some room helps us express what we do not know.

If different samples give different estimates, reporting “the mean is 171.2 cm” leaves something out. How uncertain is that estimate?

One response is to build an interval: a lower and upper value around the estimate. Below, each sample gets its own interval. Make a few, predict whether they will all contain the true population mean, then reveal it.

Give each estimate some room

Each sample comes from a simulated normal population. Its standard deviation is known to be 10 cm. Its mean is hidden until you reveal it.

Each interval reaches 3.92 cm either side of its sample mean. Changing a setting begins a new record.

0 intervals recorded.

Most recent 0 intervals
Confidence intervals. Reveal the mean to see which intervals cover it.Make a sample to get an interval.140 cm170 cm200 cm

Coverage counts include the latest 10,000 intervals; the plot shows the latest 40. An observed percentage need not equal the chosen confidence level exactly.

The interval moves; the truth does not

Each horizontal line comes from a different sample. Once revealed, the vertical line shows the single population mean they are trying to capture. Some intervals reach across it. Others miss.

A 95% confidence level describes the method: across repeated sampling under its assumptions, 95% of the intervals it produces contain the true parameter. A batch of 100 need not contain exactly 95 successes.

After an interval has been calculated, its endpoints are fixed and the population mean is fixed. It either contains the mean or it does not. The 95% describes the procedure’s long-run coverage, rather than assigning a 95% probability to that fixed parameter being in this particular interval.

A moment to think

A 95% confidence interval for mean height is 167–175 cm. What is it designed to estimate?

Two ways to change the width

Keep sample size fixed and switch from 80% confidence to 99%. The intervals widen. A method that catches the truth more often needs more room.

Now keep confidence fixed and increase sample size. The intervals narrow because sample means vary less. You gain precision without lowering the confidence level.

This experiment uses independent observations from a normal population whose standard deviation is known. That choice makes the interval method exact even for small samples. Real studies usually estimate the standard deviation too; then a t interval is often appropriate, with conditions to check.

A definition to keep

Confidence belongs to a method

A confidence interval is a range produced by a procedure designed to cover the target parameter at a stated rate over repeated samples, under specified assumptions.

estimate ± margin of error

For this experiment’s 95% intervals, the margin is about 1.96 standard errors. With 25 observations, that is 1.96 × 10 / √25 = 3.92 cm.

The compact version

x̄ ± z* σ / √n. The sample mean x̄ is the center. The known population standard deviation σ and sample size n give the standard error. The multiplier z* sets the confidence level: about 1.96 for 95%. This exact construction requires independent normal observations and known σ.

The margin accounts for sampling uncertainty in the model. It does not repair biased recruitment or inaccurate measurements.

Return to the experiment ↑

A moment to think

A factory wants a narrower interval for mean package weight while keeping the same confidence level and sampling design. What helps?

Words you met

TermMeaning
Confidence intervalAn interval from a procedure with a stated long-run coverage rate.
Confidence levelThe coverage rate the method is designed to achieve under its assumptions.
CoverageWhether an interval contains its target; across repetitions, the proportion that do.
Margin of errorThe amount added to and subtracted from the estimate in a symmetric interval.
Neighbors
  • Continue into Inference for Means to account for an unknown population standard deviation.
  • For the areas under the normal curve that determine these cutoffs, see the probability textbook’s Continuous Probability.

Written by June Kim. The conversational approach was inspired by Danielle Navarro’s Learning Statistics with R (CC BY-SA 4.0). The prose, experiments, and questions here were created for this book. This chapter’s text and illustrations are also shared under CC BY-SA 4.0.