Confidence interval
"Where is the true average?"
Targets: one population parameter, usually the mean \(\mu\).
Accounts for: sampling error only.
"We are 95% confident the average salmon in this river weighs between 5.12 kg and 5.88 kg."
Statistics · Beginner
All three give you a lower and an upper limit. They answer three very different questions. Move the sliders below and watch the three intervals grow, shrink, and hit their floors in real time.
Imagine you weigh 20 salmon caught in one river. From those 20 fish you can build three different intervals. Each one aims at a different target.
"Where is the true average?"
Targets: one population parameter, usually the mean \(\mu\).
Accounts for: sampling error only.
"We are 95% confident the average salmon in this river weighs between 5.12 kg and 5.88 kg."
"Where will the next data point fall?"
Targets: one single future observation.
Accounts for: sampling error plus fish-to-fish scatter.
"We are 95% confident the next single salmon we catch will weigh between 3.77 kg and 7.23 kg."
"Where does 99% of the population fall?"
Targets: a stated proportion of all individuals.
Accounts for: sampling error in both the mean and the spread, for a whole slice of the population.
"We are 95% confident that 99% of all salmon in this river weigh between 2.57 kg and 8.43 kg."
| Interval | What it targets | Key question | As the sample size grows | Relative width |
|---|---|---|---|---|
| Confidence (CI) | A population parameter, such as the true mean | "Where is the true average?" | Shrinks toward zero width | Narrowest |
| Prediction (PI) | One single future observation | "Where will the next data point fall?" | Shrinks, then hits a floor: individual scatter never goes away | Wider than the CI |
| Tolerance (TI) | A stated proportion of the population (for example 99%) | "Where does 99% of the population fall?" | Shrinks toward the true population percentiles | Usually the widest |
Two percentages, not one. A tolerance interval always carries two numbers: a confidence level (how sure you are, for example 95%) and a coverage (how much of the population it must hold, for example 99%). Read "95/99 tolerance interval" as "95% confident that at least 99% of individuals are inside."
These are the weights (kg) of 20 salmon from one river. We use them in every worked example below. The data is fictitious and was generated from a normal distribution for teaching.
Change the inputs. The grey curve is the population we estimate from \(\bar{x}\) and \(s\). The three bars are the intervals. The numbers and formulas update as you move.
All three intervals share one shape: centre \(\pm\) multiplier \(\times\) spread. The centre is always \(\bar{x}\). What changes is the multiplier, and that is the whole story.
When the population standard deviation is unknown (the usual case), use the \(t\) distribution:
\[ \bar{x} \pm t_{\alpha/2,\,n-1}\,\frac{s}{\sqrt{n}} \]
where \(\bar{x}\) is the sample mean, \(s\) is the sample standard deviation, \(n\) is the sample size, \(\alpha = 1 - \text{confidence level}\), and \(t_{\alpha/2,\,n-1}\) is the \(t\) value with \(\alpha/2\) of the area above it and \(n-1\) degrees of freedom. The term \(s/\sqrt{n}\) is the standard error of the mean.
If the population standard deviation \(\sigma\) is truly known, swap \(t\) for \(z\):
\[ \bar{x} \pm z_{\alpha/2}\,\frac{\sigma}{\sqrt{n}} \]
where \(z_{\alpha/2}\) is the standard normal value with \(\alpha/2\) of the area above it (1.960 for 95%).
\[ \begin{aligned} \text{CI} &= 5.50 \pm 2.093 \times \frac{0.808}{\sqrt{20}} \\ &= 5.50 \pm 0.378 \\ &= [5.12,\ 5.88]\ \text{kg} \end{aligned} \]
\[ \bar{x} \pm t_{\alpha/2,\,n-1}\, s\sqrt{1+\frac{1}{n}} \]
where every symbol means the same as above. The only change is the factor \(\sqrt{1 + 1/n}\) in place of \(1/\sqrt{n}\).
A new fish differs from our sample mean for two reasons: the new fish varies around the true mean, and our sample mean is itself a bit off. Those two errors are independent, so their variances add:
\[ \begin{aligned} \operatorname{Var}\left(X_{\text{new}} - \bar{X}\right) &= \sigma^2 + \frac{\sigma^2}{n} \\ &= \sigma^2\left(1 + \frac{1}{n}\right) \end{aligned} \]
where \(X_{\text{new}}\) is the next observation and \(\sigma^2\) is the population variance. The "1" is the fish-to-fish scatter. It does not depend on \(n\), so it never goes away. That is the PI's floor.
\[ \begin{aligned} \text{PI} &= 5.50 \pm 2.093 \times 0.808\sqrt{1 + \frac{1}{20}} \\ &= 5.50 \pm 1.733 \\ &= [3.77,\ 7.23]\ \text{kg} \end{aligned} \]
\[ \bar{x} \pm k_2\, s \]
where \(k_2\) is the two-sided tolerance factor. It depends on three things: the sample size \(n\), the coverage \(p\) (the share of the population to capture), and the confidence level \(1-\alpha\).
Minitab and published tables solve for the exact \(k_2\) numerically. A very good hand formula is Howe's approximation:
\[ k_2 \approx \sqrt{\frac{(n-1)\left(1+\frac{1}{n}\right) z^2_{(1-p)/2}}{\chi^2_{\alpha,\,n-1}}} \]
where \(z_{(1-p)/2}\) is the standard normal value with \((1-p)/2\) of the area above it (2.576 for \(p = 0.99\)), and \(\chi^2_{\alpha,\,n-1}\) is the chi-square value with \(\alpha\) of the area below it and \(n-1\) degrees of freedom (10.117 for \(\alpha = 0.05\), 19 df).
\[ \begin{aligned} k_2 &\approx \sqrt{\frac{19 \times 1.05 \times 2.576^2}{10.117}} = 3.617 \\ k_2 &= 3.621 \quad (\text{exact}) \\ \text{TI} &= 5.50 \pm 3.621 \times 0.808 \\ &= 5.50 \pm 2.925 \\ &= [2.57,\ 8.43]\ \text{kg} \end{aligned} \]
Howe's \(k_2\) gives [2.58, 8.42] kg. That small gap is why Excel (Howe) and Minitab (exact) can differ in the second decimal.
Often only one side matters, such as a minimum strength. A lower tolerance bound is
\[ \bar{x} - k_1\, s \]
where \(k_1\) is the one-sided tolerance factor. It comes from tables or software (it is based on the noncentral \(t\) distribution). It is smaller than \(k_2\) because all of the uncovered population sits on one side.
As \(n \to \infty\), \(\bar{x} \to \mu\), \(s \to \sigma\), and \(t \to z\). Each interval settles at a different limit:
| Interval | Half-width as \(n \to \infty\) | Plain words |
|---|---|---|
| CI | \(t_{\alpha/2,\,n-1}\,\dfrac{s}{\sqrt{n}} \to 0\) | You eventually know the mean exactly. |
| PI | \(t_{\alpha/2,\,n-1}\, s\sqrt{1+\tfrac{1}{n}} \to z_{\alpha/2}\,\sigma\) | The next fish still varies: the floor is \(\pm 1.96\sigma\) at 95%. |
| TI | \(k_2\, s \to z_{(1-p)/2}\,\sigma\) | It becomes the true population percentiles: \(\pm 2.576\sigma\) for 99% coverage. |
The same CI-versus-PI idea appears in regression. At a chosen predictor value \(x_0\), with fitted value \(\hat{y}_0\):
CI for the mean response:
\[ \hat{y}_0 \pm t_{\alpha/2,\,n-2}\, s_e\sqrt{\frac{1}{n} + \frac{(x_0-\bar{x})^2}{S_{xx}}} \]
PI for one new response:
\[ \hat{y}_0 \pm t_{\alpha/2,\,n-2}\, s_e\sqrt{1 + \frac{1}{n} + \frac{(x_0-\bar{x})^2}{S_{xx}}} \]
where \(s_e\) is the standard error of the regression (the residual standard deviation), \(\bar{x}\) is the mean of the predictor, and \(S_{xx} = \sum (x_i - \bar{x})^2\). Again the PI carries the extra "1", so its band is always wider, and both bands flare out as \(x_0\) moves away from \(\bar{x}\).
This chart plots each interval's half-width as a multiple of \(s\). It uses the confidence and coverage you picked in the Interval Lab. The dot marks your current \(n\). Hover or touch the chart to read values.
Log scale on the sample-size axis. At very small \(n\) the lines run off the top of the chart.
| Sample size \(n\) | CI multiplier | PI multiplier | TI factor \(k_2\) |
|---|
Read the chart like this: the CI line dives toward zero. The PI line flattens onto its floor (\(z_{\alpha/2}\)). The TI line falls fast at first and then creeps toward its own floor (\(z_{(1-p)/2}\)). More data buys you a lot of precision on the mean, and almost nothing on the next single part.
Here we play the river. We know the truth: salmon weights follow a normal distribution with \(\mu = 5.5\,\text{kg}\) and \(\sigma = 0.8\,\text{kg}\). Each click draws a fresh random sample, builds all three intervals, then checks each one against its own target.
| Interval | Counts as a hit when… |
|---|---|
| CI | it contains the true mean \(\mu = 5.5\) |
| PI | one brand-new fish, caught after the sample, lands inside it |
| TI | it actually holds at least the chosen coverage (for example 90%) of the whole population |
Click "Draw 100 samples" a few times and watch each hit rate settle near its target.
The big misconception: a 95% CI does not contain 95% of the data. In the simulator, look at the CI rows: they are far too narrow to hold most fish. The 95% is about the method: in the long run, 95% of intervals built this way capture \(\mu\). Any one interval either contains \(\mu\) or it does not.
| Situation | Interval | Why |
|---|---|---|
| Estimate the true average yield strength of a heat-treat batch | CI | The question is about the average, not any one coupon. |
| Check whether the mean fill weight moved after a changeover | CI | Compare the CI for the mean with the target; this mirrors a hypothesis test. |
| Tell a customer what the next coil's hardness will be | PI | One future item, so individual scatter matters. |
| Predict the hardness of the next part tempered at a set temperature | PI (regression) | A single future response at a given \(x\). |
| Show that at least 99% of pipe walls sit inside the thickness spec | TI | The claim is about nearly all product, with stated confidence. |
| Set a minimum strength that 95% of bolts will exceed | One-sided TI | A lower tolerance bound protects one side only. |
| Set engineering limits from a 50-part capability run | TI | Limits must cover the population, not just the mean. |
Read each situation and pick CI, PI, or TI. You get feedback straight away.
Score: 0 of 8 answered
Here is how to produce every number in this lesson with Excel and Minitab, plus what to expect on the ASQ exams.
Excel has a one-step function for the CI half-width. It has no built-in prediction or tolerance interval for a single sample, so you build those from the critical-value functions below.
| Function | Syntax | Purpose | When to use it |
|---|---|---|---|
AVERAGE | =AVERAGE(number1, [number2], ...) | Sample mean \(\bar{x}\) | The centre of all three intervals |
STDEV.S | =STDEV.S(number1, [number2], ...) | Sample standard deviation \(s\) (divides by \(n-1\)) | Always for sample data. STDEV.P is for a whole population. |
COUNT | =COUNT(value1, [value2], ...) | Sample size \(n\) | Counts numeric cells only |
CONFIDENCE.T | =CONFIDENCE.T(alpha, standard_dev, size) | CI half-width using \(t\): \(t_{\alpha/2,\,n-1}\, s/\sqrt{n}\) | CI for a mean when \(\sigma\) is unknown (most cases) |
CONFIDENCE.NORM | =CONFIDENCE.NORM(alpha, standard_dev, size) | CI half-width using \(z\): \(z_{\alpha/2}\,\sigma/\sqrt{n}\) | Only when \(\sigma\) is known. Older name: CONFIDENCE. |
T.INV.2T | =T.INV.2T(probability, deg_freedom) | Two-tailed \(t\) critical value \(t_{\alpha/2,\,n-1}\) | Building a two-sided CI or PI by hand. Use probability = \(\alpha\) (0.05 for 95%). Older name: TINV. |
T.INV | =T.INV(probability, deg_freedom) | Left-tailed inverse of \(t\) | One-sided bounds, e.g. =T.INV(0.95, 19) for a 95% one-sided limit |
NORM.S.INV | =NORM.S.INV(probability) | Standard normal value with probability below it | \(z_{\alpha/2}\) and the coverage value \(z_{(1-p)/2}\) = NORM.S.INV((1+p)/2). Older name: NORMSINV. |
CHISQ.INV | =CHISQ.INV(probability, deg_freedom) | Chi-square value with probability below it (left tail) | The \(\chi^2_{\alpha,\,n-1}\) in Howe's tolerance factor: =CHISQ.INV(0.05, 19) |
CHISQ.INV.RT | =CHISQ.INV.RT(probability, deg_freedom) | Chi-square value with probability above it (right tail) | Same number as above via =CHISQ.INV.RT(0.95, 19). Older name: CHIINV. |
SQRT | =SQRT(number) | Square root | \(\sqrt{n}\), \(\sqrt{1+1/n}\), and the \(k_2\) formula |
FORECAST.LINEAR | =FORECAST.LINEAR(x, known_y's, known_x's) | Fitted value \(\hat{y}_0\) on a straight line | Centre of a regression CI or PI |
STEYX | =STEYX(known_y's, known_x's) | Standard error of the regression \(s_e\) | Spread term in the regression CI and PI |
DEVSQ | =DEVSQ(number1, [number2], ...) | Sum of squared deviations, e.g. \(S_{xx}\) | The \((x_0-\bar{x})^2/S_{xx}\) term in regression intervals |
Paste the 20 salmon weights into cells A2:A21 (use the copy button above). Then enter these formulas. The results match the worked examples.
| Cell | What it holds | Formula | Result |
|---|---|---|---|
D2 | \(n\) | =COUNT(A2:A21) | 20 |
D3 | \(\bar{x}\) | =AVERAGE(A2:A21) | 5.50 |
D4 | \(s\) | =STDEV.S(A2:A21) | 0.8079 |
D5 | \(t_{0.025,\,19}\) | =T.INV.2T(0.05, D2-1) | 2.0930 |
D6 | CI half-width | =CONFIDENCE.T(0.05, D4, D2) | 0.3781 |
D7 | CI lower / upper | =D3-D6 and =D3+D6 | 5.12 / 5.88 |
D8 | PI half-width | =D5*D4*SQRT(1+1/D2) | 1.7326 |
D9 | PI lower / upper | =D3-D8 and =D3+D8 | 3.77 / 7.23 |
D10 | \(k_2\) (Howe), 95% confidence, 99% coverage | =SQRT((D2-1)*(1+1/D2)*NORM.S.INV((1+0.99)/2)^2/CHISQ.INV(0.05, D2-1)) | 3.6171 |
D11 | TI lower / upper | =D3-D10*D4 and =D3+D10*D4 | 2.58 / 8.42 |
Check yourself: =D5*D4/SQRT(D2) returns the same 0.3781 as CONFIDENCE.T. That is the CI formula built by hand. The PI formula differs only by swapping 1/SQRT(D2) for SQRT(1+1/D2).
Common Excel slip: T.INV.2T wants \(\alpha\) (0.05), but T.INV wants the left-tail area (0.975 for the same two-sided value). Mixing them up gives a negative or wrong \(t\).
| Goal | Menu path | Key settings and notes |
|---|---|---|
| CI for the mean (\(\sigma\) unknown) | Stat → Basic Statistics → 1-Sample t | Choose "One or more samples, each in a column" and select the weight column. Under Options set the Confidence level and keep the alternative hypothesis as "Mean ≠ hypothesized mean" for a two-sided interval. The output shows the 95% CI for \(\mu\), about (5.122, 5.878). |
| CI for the mean (\(\sigma\) known) | Stat → Basic Statistics → 1-Sample Z | Enter the Known standard deviation. Use only when \(\sigma\) truly comes from long process history. |
| CI with a picture | Stat → Basic Statistics → Graphical Summary | Shows the 95% CI for the mean, the median, and the standard deviation next to a histogram and a normality test. A good first look. |
| Tolerance interval | Stat → Quality Tools → Tolerance Intervals (Normal Distribution) | Enter the column and set Minimum percentage of population in interval (99). Under Options set the Confidence level (95) and choose Two-sided, Lower bound, or Upper bound. The output gives a Normal method interval, about (2.575, 8.425), and a Nonparametric method interval. "Summarized data" lets you enter just \(n\), \(\bar{x}\), and \(s\). |
| Tolerance interval, non-normal data | Stat → Quality Tools → Tolerance Intervals (Nonnormal Distribution) | Pick a fitted distribution such as Weibull or lognormal when the normal probability plot clearly bends. |
| PI for one new value (single sample) | Calc → Probability Distributions → t, then Calc → Calculator | Minitab has no one-sample PI dialog. Choose Inverse cumulative probability, enter 19 degrees of freedom and input constant 0.975 to get 2.093, then compute \(\bar{x} \pm t\, s\sqrt{1+1/n}\) in the Calculator. |
| CI and PI bands on a regression line | Stat → Regression → Fitted Line Plot | Under Options, tick Display confidence interval and Display prediction interval. You see both bands at once; the PI band is always the wider one. |
| CI and PI at a chosen \(x\) | Stat → Regression → Regression → Fit Regression Model, then Stat → Regression → Regression → Predict | Enter the new predictor value. The output lists a "95% CI" (mean response) and a "95% PI" (one new response) side by side. |
Which option should I use? For the mean, use 1-Sample t. For anything about individual parts against a spec, use Tolerance Intervals (Normal Distribution), and read the nonparametric result too if normality is doubtful. For a single future value from one sample, build the PI with the Calculator. For predictions from a model, use Predict after fitting it.
Knowledge check
Pick the strongest answer, then submit. Explanations appear after you submit.