Module 5: Estimation · Lesson 5.1 · about 25 min
Confidence intervals for a mean
Turn a sample mean into a range for the true mean: estimate ± multiplier × standard error. Why small samples use the t distribution instead of 1.96, how to compute and report an interval, and what makes it narrower.
Module 5 · about 25 minutes · school maths. You’ll be able to compute a t confidence interval for a mean, explain where its parts come from, and report it clearly.
In everyday terms: a weather forecast that says “18 to 22 degrees” is more honest and more useful than “20 degrees”. The width of the range tells you how sure the forecaster is.
1. From a number to a range
“Average delivery time is 32 minutes” sounds precise, but it came from one sample. A confidence interval (CI) says how far the truth could reasonably be from it: “32 minutes (95 % CI 28 to 36)”. Every CI has the same shape:
The margin of error is the part after the ±.
2. The interval for a mean
From Lesson 4.3, is roughly normal around with SE . About 95 % of the time it lands within 1.96 SEs of , so is within 1.96 SEs of . One correction: we used , an estimate, in place of . For that, use Student’s t distribution with degrees of freedom:
The t multiplier is bigger than 1.96 for small samples and settles to 1.96 as grows:
| n | 5 | 10 | 20 | 30 | 60 | 120 | ∞ |
|---|---|---|---|---|---|---|---|
| t for 95 % | 2.776 | 2.262 | 2.093 | 2.045 | 2.001 | 1.980 | 1.960 |
Move n and the level. Three things set the width: spread (s), sample size (n, through √n) and confidence level (the multiplier).
3. Reporting
- Give the estimate, the interval and the level: “Mean 32.4 min (95 % CI 28.3 to 36.5, n = 25).”
- Round sensibly: an interval of ±4 doesn’t need two decimals.
- For skewed data, consider a CI for the median via the bootstrap (Lesson 4.5), or work on log values.
- Assumptions: a random (or at least representative) sample of independent values; with small n, data that isn’t wildly skewed.
- x̄
- Your sample mean: the centre of the interval.
- SE = s/√n
- How much x̄ wobbles from sample to sample.
- t* (or 1.96)
- How many SEs to go each way for 95 %; small samples use the t distribution, which is a bit wider.
- x̄ ± t*·SE
- The interval.
- Physical meaning
- The interval is a net. The method that builds it catches the true mean in 95 % of samples; a wider net (more confidence) or a steadier estimate (more data) changes how big it must be.
“There is a 95 % chance the true mean is in my interval.” The true mean is fixed; your interval either contains it or not. The 95 % describes the method across many samples (Lesson 5.3). In practice, “we are 95 % confident” is the accepted wording.
Watch it happen, one step at a time:
Maths and principle
Principle: a CI inverts the sampling distribution. If the estimate is usually within k SEs of the truth, then the truth is usually within k SEs of the estimate.
Equations: . For 90 %, 95 % and 99 % with large n: multipliers 1.645, 1.96, 2.576.
In code: Excel =CONFIDENCE.T(0.05, s, n) gives the margin; Python scipy.stats.t.interval(0.95, n-1, loc=xbar, scale=s/np.sqrt(n)).
Why “degrees of freedom” n − 1: once the mean is fixed, only n − 1 values are free to vary; the last is decided. The same n − 1 as in the sample SD.
4. Worked example
Made-up numbers. 12 stores tried a new display. Weekly sales lift (%): 4.1, −1.2, 6.3, 2.8, 3.5, 0.4, 5.9, 2.2, −0.6, 3.8, 4.4, 1.6.
- n = 12, mean = 33.2 ÷ 12 ≈ 2.77 %.
- Sample SD s ≈ 2.39 % (from the squared gaps; a spreadsheet does this in one step).
- SE = 2.39 ÷ √12 ≈ 2.39 ÷ 3.464 ≈ 0.69 %.
- t for 11 degrees of freedom, 95 %: 2.201.
- Margin = 2.201 × 0.69 ≈ 1.52. CI: 2.77 ± 1.52 = 1.25 % to 4.28 %.
Report: “The display lifted weekly sales by about 2.8 % (95 % CI 1.2 % to 4.3 %, 12 stores).” The interval is entirely above 0, so a real lift is likely, though it could be as small as 1.2 %. (Were stores randomly chosen? If managers volunteered, Lesson 4.2 applies.)
5. Practice
- n = 100, mean 50, s = 20. Find the 95 % CI (use 1.98).
- Same data, 99 % CI (use 2.63). Wider or narrower?
- How many values would halve the width of the interval in question 1?
Answers
- SE = 2; margin 3.96; CI 46.0 to 54.0.
- Margin 5.26; CI 44.7 to 55.3. Wider: more confidence costs width.
- About 400 (four times as many).
Try it on your own data: the hypothesis tests tool gives t intervals for a column of numbers; the bootstrap test tool gives bootstrap intervals for skewed data.
New words: confidence interval, margin of error, confidence level, Student’s t distribution, degrees of freedom.
- Interval = estimate ± multiplier × SE.
- For a mean: x̄ ± t*·s/√n, with n − 1 degrees of freedom.
- More data or less variation narrows it; more confidence widens it.
- Report the interval with the estimate and n, and say what range would change the decision.
Check yourself
Sources
- OpenIntro Statistics, 4th edition (Diez, Cetinkaya-Rundel, Barr), Section 7.1 One-sample means with the t-distribution https://www.openintro.org/book/os/
- NIST/SEMATECH e-Handbook, 7.2.2.1 Confidence interval approach https://www.itl.nist.gov/div898/handbook/prc/section2/prc221.htm
Your ticks stay in this browser. Save them as a file on the course home.
Updated 2026-11-22. Numbers in the examples are made up to show the idea unless a source is given. Simulations run in your browser; nothing you type is sent anywhere.