What a confidence interval means
A sample mean or percentage is only an estimate of the true population value. A confidence interval puts a range around the estimate that reflects sampling error: estimate ± margin of error.
A 95% confidence level describes the method, not one particular interval. If you repeated the study many times and built an interval each time, about 95% of those intervals would contain the true value. It is not quite right to say there is a 95% probability that the true mean is inside this specific interval — but "we are 95% confident" is the accepted plain-language summary.
Formulas: z, t and the Wilson score interval
Mean, σ known (rare in practice):
x̄ ± z* · σ ÷ √n
Mean, σ unknown (the usual case) — replace σ with the sample standard deviation s and z* with Student's t* with n − 1 degrees of freedom:
x̄ ± t*(n−1) · s ÷ √n
The t distribution has heavier tails than the normal, which widens the interval to account for the uncertainty in s. For 95% confidence, t* is 12.71 with 1 df, 2.262 with 9 df, 2.064 with 24 df and approaches 1.960 as n grows.
Proportion. With x successes in n trials, p̂ = x ÷ n. The textbook Wald interval is p̂ ± z*·√(p̂(1 − p̂) ÷ n). It is simple but performs badly for small n or proportions near 0% or 100% — at x = 0 it has zero width. The Wilson score interval fixes this:
(p̂ + z²/2n ± z·√(p̂(1−p̂)/n + z²/4n²)) ÷ (1 + z²/n)
Its actual coverage stays close to the nominal level, which is why Agresti & Coull, Newcombe and most modern texts recommend it. The calculator shows both and uses Wilson for the headline.
Worked examples
Mean. A sample of n = 25 has x̄ = 50 and s = 10; σ is unknown.
- SE = 10 ÷ √25 = 2
- t* with 24 df at 95% = 2.0639
- Margin of error = 2.0639 × 2 = 4.128
- Interval: 45.87 to 54.13
If σ = 10 were known, z* = 1.96 would give the slightly narrower 46.08 to 53.92.
Proportion. 56 of 80 customers (70%) say they would buy again. The 95% Wilson interval is 59.23% to 78.94%; the Wald interval is 59.96% to 80.04%. Notice that Wilson is pulled slightly toward 50%.
Assumptions and common mistakes
- The data should be a random sample of independent observations.
- For a t interval with fewer than about 30 observations, the population should be roughly normal; check a histogram for strong skew or outliers.
- A confidence interval covers sampling error only — not measurement bias or a non-representative sample.
- Overlapping intervals for two groups do not prove the groups are equal; compare them with a proper two-sample test.
- To plan how many observations you need for a target width, use the sample size calculator.
Frequently asked questions
When should I use t instead of z?
Use t whenever the standard deviation comes from the same sample — which is almost always. Use z only when the population σ is genuinely known, or for proportions.
Why does a 99% interval come out wider than a 95% one?
To be more confident of capturing the true value you need a wider net. The critical value rises from 1.96 to 2.576, so the margin of error grows by about 31%.
Why is the Wilson interval not symmetric around p̂?
Proportions are bounded by 0 and 1, so uncertainty is lopsided near the edges. Wilson's centre is shifted toward 50%, which keeps the interval inside 0–100% and gives better coverage.
How can I make the interval narrower?
Increase the sample size (the width shrinks with √n), reduce measurement variability, or accept a lower confidence level.
Sources & references
Last reviewed: