Lesson 2 · 25 min

Confidence intervals and Student’s t

Only four measurements — what does the mean tell you about the true value? Student’s t gives an honest confidence interval, and shows why extra replicates soon bring diminishing returns.

In this lesson

  • Calculate a confidence interval from the mean, the standard deviation and Student’s t
  • Interpret a “95 % confidence interval” correctly
  • Explain why small samples need t rather than 1.96
  • Estimate how many replicates are needed for a given interval width

A tablet is labelled 250 mg of active ingredient, and four analyses average 247.5 mg. Is the tablet short? It depends on how far that mean might be from the truth: if the four results agree within 0.2 mg the shortfall is probably real; if they differ by 5 mg a mean 2.5 mg low could easily be luck. A confidence interval turns “how far it might be” into a number: a range around the mean that contains the true value with a stated level of confidence.

Predict first

A hundred laboratories each make 4 measurements and each compute a 95 % confidence interval. About how many of the intervals contain the true value?

Pick an answer and lock it in before you look. A wrong guess teaches more than no guess.

Student’s t distribution

If the true σ were known, the 95 % interval for the mean would be xˉ±1.96 σ/n\bar{x} \pm 1.96\,\sigma/\sqrt{n}. But in the lab we only have the sample standard deviation s, and with few measurements s is itself unreliable — sometimes too small, which makes the interval too narrow. In 1908 William Gosset, a chemist at the Guinness brewery, published the fix under the pen name “Student”: replace the normal distribution with the t distribution. It is lower and wider, with heavier tails — the more so the fewer the degrees of freedom ν = n − 1 — and turns back into the normal distribution as n grows.

μ=xˉ±t sn,ν=n−1\mu = \bar{x} \pm \frac{t\,s}{\sqrt{n}},\qquad \nu = n - 1
Two-sided t for 95 % confidence: 12.706 for ν = 1, 2.776 for ν = 4, 2.262 for ν = 9 and 1.960 as ν → ∞.
μ\mu
the true value (population mean)
tt
Student’s t, set by the confidence level and the degrees of freedom
s/ns/\sqrt{n}
the standard error of the mean
ν\nu
degrees of freedom: n results minus the one used up by the mean
Half-width of the 95 % interval in units of s (t/√n): the first few replicates pay most
nt (ν = n − 1)Half-width / s
212.7068.98
34.3032.48
43.1821.59
52.7761.24
102.2620.72
202.0930.47
Source: Computed from the t distribution (checked against the t table in Harris, Quantitative Chemical Analysis, ch. 4).

Going from 2 to 3 measurements shrinks the interval more than threefold; going from 10 to 20 shrinks it by only another third. That is why routine analyses usually run 3–5 replicates. You can also plan backwards: expecting s = 0.40 and wanting a 95 % half-width of 0.25 or less, solve t s/n≤0.25t\,s/\sqrt{n} \le 0.25 — it takes 13 measurements.

Does each interval x̄ ± t·s/√n catch the true value?

Confidence intervals: 50 repeated experiments

9.49.69.81010.210.410.6Result (true value = 10.00)11020304050Experiment
t = 4.303 −6−4−20246t00.10.20.30.4Probability density
  • t distribution (ν = 2)
  • Standard normal
Critical value t
4.303
Critical value z
1.960

Half-width = 1.960 × s/√n; for n = 3, t is 120 % larger than z.

38 of the 50 intervals contain the true value

In the long run (4000 experiments): 82.1 %

Each “experiment” takes n results from a normal distribution with mean 10.00 and σ = 0.20 (generated by a deterministic hash); the interval uses the sample standard deviation s and the t critical value t(1 − α/2, n − 1). The t quantile is found by numerically inverting the incomplete beta function and checked against the usual table (2.776 for ν = 4). With “use z instead of t” small samples give intervals that are too narrow, and they catch the true value noticeably less often than the nominal level.
Here z = 1.96 is used on purpose, with only 3 measurements per experiment: count the misses among the 50 intervals and read the long-run coverage below — well under 95 %. Untick the box to use t = 4.303 and the coverage returns to about 95 %; then raise n to 30 and the difference between t and z all but vanishes.

Worked example

Carbohydrate in a glycoprotein

Five determinations of carbohydrate in a glycoprotein give 12.6 %, 11.9 %, 13.0 %, 12.7 % and 12.5 % by mass. Find the 95 % and 90 % confidence intervals.

Concept check

With s unchanged, going from 4 to 16 replicates shrinks the half-width of the 95 % confidence interval by about what factor?

Try the calculation

Five determinations of nitrate in a water sample give xˉ=10.08\bar{x} = 10.08 mg/L and s=0.15s = 0.15 mg/L. What is the half-width of the 95 % confidence interval in mg/L?

mg/L

Key takeaways

  • Confidence interval μ = x̄ ± t·s/√n with ν = n − 1; the 95 % t value falls from 12.706 (ν = 1) to 1.960 (ν → ∞).
  • “95 %” is the method’s success rate: in the long run 95 % of intervals contain the true value.
  • Small samples need t; using 1.96 makes the interval too narrow.
  • The first few replicates pay most; 3–5 replicates is the usual compromise in routine analysis.
Progress is stored only in this browser and never uploaded.

Data and references

  1. Student [W. S. Gosset], “The probable error of a mean”, Biometrika 6, 1–25 (1908).
  2. D. C. Harris, Quantitative Chemical Analysis, 9th ed., W. H. Freeman (2016), chapter 4 (confidence intervals and Student’s t).
  3. JCGM 100:2008, Evaluation of measurement data — Guide to the expression of uncertainty in measurement (GUM), BIPM.