Professor Turing

Study guides

Confidence and prediction intervals

Last updated: 2026-11-26

In regression, a confidence interval gives a range for the average response at a chosen x. A prediction interval gives a range for one new observation at that x. The prediction interval is wider, because it allows for uncertainty about the average and also for the scatter of a single observation around it.

Start learning No account needed

1. Two different questions

"What is the average delivery time for 5 km trips?" asks about a mean, so it calls for a confidence interval. "How long will the next 5 km delivery take?" asks about one trip, so it calls for a prediction interval. Underline the word "average" or "next" in the question before you compute anything.

2. A worked example: eight deliveries

The distances and times are made up.

Distance (km)Time (minutes)
112
215
319
420
526
627
731
834

The numbers below are computed by scripts/confidence-interval-vs-prediction-interval-worked-example.py in the Professor Turing repository. Output:

n = 8, mean distance = 4.5, mean time = 23, Sxx = 42
fitted line: minutes = 8.857 + 3.143 x km
residual standard deviation s = 0.926, t cutoff (6 df) = 2.447
at 5 km: fitted = 24.57, SE of mean = 0.335, SE for one new delivery = 0.985
  95% confidence interval: 23.75 to 25.39 (half-width 0.82)
  95% prediction interval: 22.16 to 26.98 (half-width 2.41)
at 8 km: fitted = 34.00, SE of mean = 0.598, SE for one new delivery = 1.102
  95% confidence interval: 32.54 to 35.46 (half-width 1.46)
  95% prediction interval: 31.30 to 36.70 (half-width 2.70)
same distances repeated, s held fixed, at 5 km:
  n = 8: confidence half-width 0.82, prediction half-width 2.41
  n = 80: confidence half-width 0.21, prediction half-width 1.86
  n = 800: confidence half-width 0.07, prediction half-width 1.82
observed times inside the interval at their own distance: confidence 6 of 8, prediction 8 of 8
1.960 x s = 1.81

3. The one term that differs

For a straight line with one predictor, the standard error of the fitted average at x₀ is s × √(1/n + (x₀ − x̄)² / Sxx). Here s is the residual standard deviation, x̄ is the mean distance and Sxx is the sum of squared distances from that mean. For one new observation it is √(s² + that standard error²). The extra s² is the scatter of a single delivery.

At 5 km the fitted time is 24.57 minutes. The two standard errors are 0.335 and 0.985. Multiply each by the t cutoff for 6 degrees of freedom, 2.447. The 95% confidence interval for the average is 23.75 to 25.39 minutes. The 95% prediction interval for one delivery is 22.16 to 26.98 minutes.

At 8 km, farther from the mean distance of 4.5, both intervals are wider. Neither calculation justifies a prediction far beyond the distances you observed, because the data cannot show whether the line continues there.

4. What more data does

Imagine the same eight distances repeated 10 or 100 times, with s staying at 0.926. This is a constructed scenario, since real data would give a new s. The confidence half-width at 5 km falls from 0.82 to 0.21 and then 0.07. The prediction half-width falls from 2.41 to 1.86 and then 1.82. It is heading toward 1.960 × s, about 1.81, because more deliveries do not remove the scatter of the next one.

5. A common misconception: the 95% confidence band should hold 95% of the points

In our data, 6 of the 8 observed times fall inside the confidence interval at their own distance, and 8 of 8 fall inside the prediction interval. With many more deliveries the confidence interval would become very narrow around the line and could leave most single times outside, with nothing wrong. It was built to locate the average. Eight points are also too few to check a 95% rate.

6. What both intervals assume

These formulas rest on a model: a straight line that describes the average well, randomly sampled deliveries, errors that average zero and have a similar spread across distances, and, for the t cutoff, errors that are roughly normal. NIST’s handbook, section 4.2.1, lists the typical assumptions. Plot the residuals before you trust either interval. NIST's handbook calls plots of the residuals the primary tool for model validation in most process modeling.

7. Test yourself

For each question, name the interval and say why. Then open the answer.

Question 1. A manager wants to report the long-run average time for 8 km trips.

Answer to question 1

Confidence interval, 32.54 to 35.46 minutes. The question is about an average.

Question 2. A customer 8 km away asks when their order will arrive.

Answer to question 2

Prediction interval, 31.30 to 36.70 minutes. The question is about one delivery.

Question 3. Why is the interval at 8 km wider than the one at 5 km?

Answer to question 3

8 is farther from the mean distance of 4.5 than 5 is, so the (x₀ − x̄)² term is larger and the line is less certain there.

Start from what is a confidence interval or what is linear regression if either idea is new.

What the sources found, and their limits

NIST/SEMATECH e-Handbook of Statistical Methods, sections 4.5.1.1 and 4.5.1.2. The first gives confidence intervals for the average response. The second gives prediction intervals for a new measurement, and explains that their uncertainty combines that of the fitted average with the residual standard deviation. Sources: 4.5.1.1, estimating the average response and 4.5.1.2, predicting a single response, read on 2026-11-25.

NIST/SEMATECH e-Handbook, section 4.2.1. Lists typical modelling assumptions, including random errors with mean zero, constant standard deviation and a normal distribution, and randomly sampled data. Limits: a US government handbook that covers process modelling in general. Source: 4.2.1, underlying assumptions, read on 2026-11-25.

NIST/SEMATECH e-Handbook, section 4.4.4. Names graphical residual analysis as the primary tool for model validation in most process modeling. Source: 4.4.4, model fit, read on 2026-11-25.

Wikipedia on simple linear regression, prediction intervals and extrapolation. They give the variance of the mean response and of a predicted response for a straight line, contrast prediction with confidence intervals, and warn that estimates beyond the observed range are more uncertain. Limits: reference articles under CC BY-SA 4.0; that the intervals widen away from the mean of x is our reading of the formulas. Sources: Simple linear regression, Prediction interval and Extrapolation, read on 2026-11-25. The delivery data, the repeated-data scenario and the count of points inside each interval are ours.

How Professor Turing helps

Professor Turing is a tutor for adults learning any subject, in college or on their own. It asks you questions instead of giving the final answer, does not grade a bare guess, and remembers what you got wrong. No account is needed to start. It's an AI tutor, free to try.

Bring a regression question you are stuck on. Its first reply asks about your attempt, such as which interval you chose and why, before it teaches anything. You must be 18 or older. Guest conversations are deleted 7 days after your last activity; with an account they are kept while the account is active.

FAQ

Which interval is wider? At the same x and the same confidence level, the prediction interval is wider. It includes the uncertainty in the fitted average plus the scatter of a single new observation.

Does more data shrink a prediction interval to nothing? No. More data can narrow the uncertainty about the average, but individual observations still scatter around it. In our constructed scenario the half-width levels off near 1.81 minutes.

Which one answers a question about the next observation? The prediction interval. Use the confidence interval when the question asks about the average response at that value of x.

Start with what you're working on

Tell the tutor which regression question you are working on and let it ask you the questions.

Start learning No account needed

See also: what is a confidence interval · all study guides