15 / Inference
Confidence interval for a population mean
A confidence interval expresses sampling uncertainty around an estimated population mean. When the population standard deviation is unknown, a t interval uses the sample spread and sample size under appropriate sampling assumptions.
The business question
How precisely have we estimated the average, rather than just measured this sample?
- Quantify uncertainty about average service time, cost or process output.
- Compare a proposed average-performance threshold with the precision of current evidence.
- Decide whether collecting more representative data could materially improve a business decision.
How the method works
The sample mean changes when a different sample is drawn. Its standard error estimates that sampling variation and is usually s/sqrt(n) for independent observations. This differs from the sample standard deviation s, which describes the spread of individual records. Increasing the sample size can narrow uncertainty about the average without making individual customer experiences more consistent.
A two-sided t interval places a critical-value multiple of the standard error on either side of the sample mean. The t critical value depends on n−1 degrees of freedom and is larger for small samples than the corresponding normal value. For an independent normal population the usual t interval has its stated coverage; strong skewness, dependence and selection bias can compromise that interpretation.
A 95% confidence procedure would contain the fixed population mean in about 95% of repeated samples under its assumptions. The already-computed interval is not a statement that 95% of individual jobs fall inside its endpoints. It is also not a Bayesian 95% probability distribution for the parameter. State the interval’s role in the decision, such as whether it is precise enough to support an average-time commitment.
The calculation
| Symbol | Meaning |
|---|---|
| x̄ | Sample mean of the measured outcome. |
| s | Sample standard deviation, calculated with n−1 in the variance denominator. |
| n | Number of independent observations. |
| α | One minus the confidence level; 0.05 for a 95% two-sided interval. |
| t_(1−α/2,n−1) | Student t percentile using n−1 degrees of freedom. |
A worked business example
ILLUSTRATIVE SCENARIO
Illustrative repair operation collects 25 randomly selected, independent jobs from a stable and approximately normal job-time population. The sample mean is 42 minutes with sample standard deviation 10 minutes.
Inputs
- n = 25; sample mean = 42 minutes; sample SD = 10 minutes.
- Two-sided confidence level = 95%.
- A manager is considering an average-time objective of 45 minutes.
Work through the numbers
- Calculate the standard error: 10/sqrt(25) = 2 minutes.
- Degrees of freedom = 25 − 1 = 24. The 97.5th t percentile is 2.0638986.
- Margin = 2.0638986 × 2 = 4.1277971 minutes.
- Lower endpoint = 42 − 4.1277971 = 37.8722. Upper endpoint = 42 + 4.1277971 = 46.1278 minutes.
The observed mean is below 45 minutes, but this interval still includes population means above 45. It does not support a claim that 95% of individual repairs finish within 46.13 minutes.
Explore the decision
Estimate a population mean. The live explorer has its own example inputs; it is separate from the worked calculation above.
Enable JavaScript to use this calculator. The worked example and executable Python remain available.
Apply it at work
- Define the population mean and the business threshold or estimation precision that matters.
- Collect a relevant probability-based or otherwise justified sample with independent measurement units.
- Inspect distribution, time pattern and sample quality; compute the t interval with the correct standard error.
- Use the interval together with costs and practical effect sizes, and plan additional data if the remaining uncertainty changes the decision.
Check these assumptions
- The observations represent the target population rather than a convenient selected subset.
- The basic formula assumes independent observations; repeated customers or clustered shifts need adjustment.
- Exact t coverage requires normal observations, with appropriate large-sample robustness assessed rather than presumed.
- The population standard deviation is unknown and the sample SD is an appropriate estimate of its spread.
Common mistakes and how to avoid them
- Replacing s/sqrt(n) with s creates an interval for the wrong source of variation.
- A confidence interval for the mean is not a prediction interval or a customer service-level range.
- A narrow interval can still be biased if the sample excludes slow, cancelled or difficult jobs.
How this can help the business
- Managers can distinguish a promising average from sufficiently precise evidence for a commitment.
- Sample-size discussions can focus on the uncertainty that matters to a decision rather than an arbitrary number of records.
Define the practical threshold and the intended interval before analysing; if the plausible means change the action, improve the evidence or use a cautious staged decision.
When to use another approach
Use a paired or two-sample interval for comparisons, a bootstrap interval when justified, or a design-adjusted interval for complex sampling.
Reproduce the worked example in Python
The code is self-contained for this example. Dependencies and run instructions are included with the downloadable notebook.
Show executable code and recorded output
from math import sqrt
from scipy.stats import t
n, mean, sample_sd = 25, 42, 10
standard_error = sample_sd/sqrt(n)
critical = t.ppf(0.975,n-1)
margin = critical*standard_error
print(f'Standard error: {standard_error:.2f} min')
print(f'95% t interval for mean: {mean-margin:.2f} to {mean+margin:.2f} min')Recorded output
Standard error: 2.00 min 95% t interval for mean: 37.87 to 46.13 min
Sources and further reading
Concepts are linked to primary teaching or technical sources. The business examples are illustrative applications, not reported client results.