A confidence interval gives a range of plausible values for an unknown population mean. It is the sample mean plus or minus a margin of error, a critical value times the standard error s/√n, so a larger sample size tends to give a narrower interval. When σ is unknown, the critical value comes from the t distribution with n−1 degrees of freedom. The confidence level describes how often the method captures the true mean, not the chance that one computed interval is right.
You time your commute on 25 randomly chosen days. The average is 32 minutes, and the times vary with a standard deviation of 10 minutes. Your true long-run average is almost surely not exactly 32. How far off could it be?
Single days vary by about 10 minutes. An average of 25 days varies much less, because fast days and slow days cancel. Its typical error is 10/√25=2 minutes.
A sample average lands within about two of those typical errors of the true mean in about 95% of samples. That makes 32±4 minutes, from 28 to 36, a sensible range of plausible values for your true average. A careful version replaces the 2 with 2.064, giving 27.87 to 36.13 minutes. That range is a 95% confidence interval.
32±2.064⋅√2510≈32±4.13
The rule
Estimate plus or minus a margin
A confidence interval for a population mean μ is the sample mean xˉ plus or minus a margin of error. The margin is a critical value t∗ times the standard error s/√n, where s is the sample standard deviation and n the sample size. t∗ comes from the t distribution with n−1 degrees of freedom. It is chosen so that the middle of that distribution holds the confidence level, such as 95%.
xˉ±t∗√ns
The standard error
s/√n measures how much the sample mean varies from sample to sample. It shrinks as n grows, and quadrupling the sample size halves it. It is not the spread of individual values, which stays near s however large the sample is.
Critical values
For 95% confidence the middle 95% leaves 2.5% in each tail, so t∗ is the value with 0.025 of the area above it. A t table lists it by degrees of freedom, and invT(0.975, df) or the t table in Statistics gives it too. For 90% confidence each tail holds 5%, and for 99% each holds 0.5%. With few degrees of freedom t∗ is well above the normal value 1.96, and it falls toward 1.96 as n grows.
Critical values t∗ for 95% confidence
Degrees of freedom
t∗
5
2.571
10
2.228
15
2.131
30
2.042
100
1.984
Normal (z∗)
1.960
What 95% confidence means
If the sampling were repeated many times, about 95% of the intervals built this way would contain μ. A single computed interval either contains μ or does not, and the 95% describes the method. The usual sentence is “95% confident that the mean is between 27.87 and 36.13 minutes”.
Why it works
Why √n, and why t
Each observation varies with standard deviation σ. A sum of n independent observations has variance nσ2, because independent variances add. The mean divides that sum by n, which divides the variance by n2, leaving σ2/n. Its standard deviation is σ/√n.
For a large enough sample, the sample mean is close to normal by the central limit theorem. xˉ then lies within 1.96σ/√n of μ in 95% of samples. Turned around, μ lies within 1.96σ/√n of xˉ in those same samples. That reversal is the whole idea of a confidence interval.
In practice σ is unknown, and s stands in for it. s varies from sample to sample too, and a small sample can underestimate it badly. The t distribution allows for that extra uncertainty with heavier tails than the normal, so t∗ is larger than 1.96. As n grows, s settles near σ and t∗ falls toward 1.96.
SD(xˉ)=√nσ
The method
A t interval in six steps
The table builds the interval for the commute times. The last step matters as much as the first. An interval is reported as a sentence about the mean, in the data’s units.
A 95% t interval for the mean commute
Step
What to do
For the commute
1
Check the conditions
25 random days, independent, no clear outliers
2
Write down xˉ,s and n
32 minutes,10 minutes,25
3
Find the standard error s/√n
10/√25=2
4
Find the degrees of freedom and t∗
24 and 2.064
5
Find the margin t∗×SE
2.064×2≈4.13
6
Write the interval and say what it means
27.87 to 36.13 minutes,95% confidence for the mean commute
Choosing a sample size
To plan a study, decide the margin E you want and solve E=z∗σ/√n for n. Use z∗ rather than t∗, because n is not known yet, and use a guess for σ from a pilot study or an earlier one. Round n up, since rounding down leaves the margin a little too wide.
n=(Ez∗σ)2
Where it breaks
Where it breaks
The interval needs a random sample of independent observations. A convenience sample, such as asking your friends, can give a narrow interval around the wrong value. No margin of error fixes a biased sample.
The t interval also needs the sample mean to be close to normal. A common guide checks the data. With fewer than 30 observations, there should be no clear outliers. With 30 or more, there should be no extreme ones.
The interval is about the mean, not individual values. The commute interval 27.87 to 36.13 minutes says where the long-run average is. Single days spread far wider, roughly 32±20 minutes.
z∗=1.96 with s from a small sample makes the interval too narrow. With n=16, that method captures μ in only about 93% of samples, not 95%. For n=8 it is about 91%.
This lesson’s interval is for a mean. A proportion, such as the share of voters who agree, uses p^±z∗√p^(1−p^)/n instead. The shape, an estimate plus or minus a critical value times a standard error, is the same.
Check your answer
Check your answer
An interval carries its own center and width, so it can be read backward to test it.
The interval is centered on xˉ. The average of the two ends must be xˉ, and half the distance between them must be the margin. The first example weighs 16 packages, with xˉ=52.3 g and s=6.4 g, and gets the interval 48.89 to 55.71 g. Its center and half-width are 52.3 and 3.41, as they should be.
The width moves the right way. A higher confidence level widens the interval, a larger sample narrows it, and t∗ is always above 1.96 for a 95% interval. The units are the data’s units.
Summarize the data in Statistics gives the mean, s and the standard error directly, and its t table gives t∗.
To have Chalk check the work, put the givens on the first row of a Math box, as xˉ=52.3,s=6.4,n=16. Then write SE=s/√n=6.4/√16=1.6,t∗=2.131 and ME=t∗⋅SE=2.131⋅1.6≈3.41 on rows of their own. The Checker marks the standard error and the margin ✓, or ✗ when a number is wrong. A wrong standard error written without s/√n, such as SE=6.4/16=0.4, reads “?”, not ✗. Its hint says “Check the rule: SE = s/√n.” It takes t∗ as a value you supply, so read it from the table with care.
Write the interval as 52.3±3.41, then (48.89,55.71). Chalk compares the second row’s ends with the first and marks it ✓, or ✗ when an end is wrong.
Two samples from one population have the same s, with n=10 and n=90. Is the larger sample’s 95% margin of error a third of the smaller one’s?
A little less, about 0.29 of it. Nine times the data divides the standard error s/√n by √9=3.t∗ also falls, from about 2.262 with 9 degrees of freedom to about 1.987with 89. Together that is (1/3)×(1.987/2.262)≈0.29. Expecting a ninth divides by n instead of √n.
What the interval leaves out, and where it leads
A 95% confidence interval contains exactly the values of μ that a two-sided t-test at the 5% level would not reject. The interval and the test are one calculation read two ways.
The t interval is exact only for normal data, but it holds up well for moderate skew once n is a few dozen, which is why the guide above loosens with n. For small, skewed samples, a bootstrap interval resamples the data itself to see how much the mean varies.
Saying “there is a 95% probability that μ is in this interval” needs a different framework. A Bayesian credible interval treats μ as uncertain, starts from a prior belief about it and updates that belief with the data. With little prior information, the two kinds of interval often nearly agree, though they answer different questions.
Common mistakes
Saying there is a 95% probability that μ lies in this interval. Once computed, 48.89 to 55.71 either contains μ or does not. The 95% describes the method, which captures μ in 95% of samples.
Using z∗=1.96 with a small sample and s. For n=16,t∗ with 15 degrees of freedom is 2.131. With 1.96 the interval is too narrow and captures μ only about 93% of the time.
Dividing s by n instead of √n. For the 16 packages with s=6.4 g,6.4/16=0.4 makes the margin four times too small. The standard error is 6.4/√16=1.6.
Treating the interval as the range of individual values. The sleep interval 4.33 to 7.67 hours is for the mean. The sample alone runs from 3 to 9 hours, and single nights vary much more than an average does.
Using n degrees of freedom instead of n−1. With n=8,t∗ uses 7 degrees of freedom and is 2.365. The row for 8 gives 2.306, and the interval comes out slightly too narrow.
Rounding a planned sample size down. (1.96×15/3)2=96.04, and 96 people give a margin a little over 3. Round up to 97, so the margin is at most 3.
Key terms
Confidence interval
A range of plausible values for a population parameter, from a method that captures the true value in a set share of samples, such as 95%. One computed interval either contains the parameter or doesn’t. The 95% describes the method.
Confidence level
How often the interval method captures the true parameter over many samples, such as 95%. A higher confidence level gives a wider interval from the same data.
Margin of error
The half-width of a confidence interval: a critical value times the standard error of the estimate. It covers sampling variation only, not bias from a poor sample or bad measurements.
Standard error
The standard deviation of an estimate, such as a sample mean, from sample to sample. For a mean it is estimated by s/√n, so larger samples give smaller standard errors.
Student t distribution
A bell-shaped distribution like the standard normal but with heavier tails, used when the population standard deviation is estimated from the sample. With more degrees of freedom it gets closer to the normal.
Degrees of freedom
The number of values free to vary once estimates have been fixed, such as n−1 for one sample’s standard deviation. It sets the shape of the t, chi-square and F distributions.
Critical value
The cutoff from a reference distribution, such as z∗=1.96 for 95% confidence, that marks off a chosen tail area. It depends on the distribution, the tails used and any degrees of freedom.
Work through an example
A random sample of 16 packages has mean mass 52.3 g and standard deviation 6.4 g. Build a 95% confidence interval for the mean mass of all packages.