Prediction Interval Calculator

Prediction Interval Calculator

Build the prediction interval for one new observation from your regression data, side by side with the narrower confidence interval for the mean.

Numbers separated by commas, spaces or line breaks.
The same number of values as x, in the same order.
The x value for the new observation.
95% PREDICTION INTERVAL
[1.0819, 7.3181]

A new observation at x₀ = 3 is predicted to fall between 1.0819 and 7.3181 with 95% confidence.

Calculation

    Prediction and confidence bands

    The red dashed band is the prediction interval; the blue dotted band is the confidence interval for the mean. The dot at x₀ is the predicted value.

    The prediction interval is always wider than the confidence interval for the same x₀ — the extra “1” under the square root is the new observation’s own scatter around the line.

    The prediction interval calculator builds the interval for one new observation from your regression data, shown side by side with the narrower confidence interval for the mean. Paste your x and y values, pick x0, and read both intervals from the chart. A mean-based mode is included too.

    What is a prediction interval?

    A prediction interval is the range where a single new observation is expected to fall, with a stated confidence level — usually 95%. It is built from a regression line fitted to your data, or from a sample mean and standard deviation. It is always wider than the confidence interval for the mean at the same point, because it must allow for two things at once: the uncertainty in the fitted line, and the new observation’s own scatter around that line.

    The difference is one number under the square root. The confidence interval for the mean at x₀ uses Ŷ ± t* · sₑ · √(1/n + (x₀ − x̄)² / Sxx). The prediction interval uses the same expression with an extra “1 +” in front: Ŷ ± t* · sₑ · √(1 + 1/n + (x₀ − x̄)² / Sxx). That lone 1 is the new observation’s own variance — the scatter of a single point around the line. Without it, you have a confidence interval, not a prediction interval.

    Use a prediction interval when you want to say where the next value will land — the next patient’s reading, the next batch’s measurement, the next student’s score. Use a confidence interval when you want to estimate the mean — the average reading, the average measurement, the average score.

    How to use the prediction interval calculator

    The calculator has two modes. In Regression mode, paste your x values and your y values (the same count, in the same order), pick the x₀ you want to predict at, and choose a confidence level. It fits the least-squares line, then shows the prediction interval and the confidence interval for the mean side by side, with a chart of both bands. In Mean-based mode, enter a sample mean, a sample standard deviation and a sample size — no regression data needed — and it builds the prediction interval from those three numbers.

    Try it now. Paste x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 6, and predict at x₀ = 3 with 95% confidence. The fitted line is Ŷ = 1.8000 + 0.8000x, the residual standard error is sₑ = 0.8944, and the calculator gives a prediction interval of [1.0819, 7.3181] and a confidence interval for the mean of [2.9270, 5.4730]. The prediction interval is 2.4495 times as wide.

    Try the mean-based mode. With a sample mean of 50, a sample standard deviation of 8 and n = 20, the 95% prediction interval is [32.8423, 67.1577] — a half-width of 17.1577.

    The formula — and the “lone 1”

    For a regression, with Ŷ the fitted value at x₀, sₑ the residual standard error, t* the two-tailed critical t value with n − 2 degrees of freedom, and Sxx = Σ(x − x̄)²:

    Prediction interval: Ŷ ± t* · sₑ · √(1 + 1/n + (x₀ − x̄)² / Sxx)

    Confidence interval for the mean: Ŷ ± t* · sₑ · √(1/n + (x₀ − x̄)² / Sxx)

    For a single sample (the mean-based mode), with x̄ the sample mean, s the sample standard deviation, t* the critical t with n − 1 degrees of freedom:

    Prediction interval: x̄ ± t* · s · √(1 + 1/n)

    The “1” is the whole point. That lone 1 under the square root is the variance of a single new observation around the line. The rest of the term (1/n + (x₀ − x̄)² / Sxx) is the variance of the estimated mean — the part the confidence interval carries. A prediction interval carries both, so it is always wider than the confidence interval for the same x₀.
    Watch out for the wrong formula. Some online calculators compute x̄ ± z · σ / √n and call it a “prediction interval”. That is a confidence interval for the mean — it leaves out the new observation’s own scatter entirely. This page uses the correct formula, with the “1 +”, and shows both intervals side by side so you can see the difference.Worked examples

    Example 1 — regression

    Take x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 6, and predict at x₀ = 3 with 95% confidence. The mean of x is 3 and the mean of y is 4.2, Sxx = 10 and Sxy = 8, so the slope is 0.8000 and the intercept is 1.8000. The residuals give SSE = 2.4000, so sₑ = √(2.4000 / 3) = 0.8944. The fitted value at x₀ = 3 is Ŷ = 4.2000, and the critical t with 3 degrees of freedom is t* = 3.1824. The prediction interval is 4.2000 ± 3.1181 = [1.0819, 7.3181]; the confidence interval for the mean is 4.2000 ± 1.2730 = [2.9270, 5.4730]. The prediction interval is 2.4495 times as wide.

    Example 2 — mean-based

    Take a sample mean of 50, a sample standard deviation of 8 and n = 20, at 95% confidence. The degrees of freedom are 19, so t* = 2.0930. The half-width is 2.0930 × 8 × √(1 + 1/20) = 17.1577, so the prediction interval is 50 ± 17.1577 = [32.8423, 67.1577].

    Why is the prediction interval always wider?

    Because a new observation varies around the line by its own scatter, and the prediction interval must pay for that scatter. The confidence interval only carries the uncertainty in the estimated mean — the 1/n term (how well the line’s height is known) and the (x₀ − x̄)² / Sxx term (how far x₀ is from the centre of the data). The prediction interval adds 1 for the new observation’s own deviation. Since 1 + 1/n + (x₀ − x̄)² / Sxx is always larger than 1/n + (x₀ − x̄)² / Sxx, the prediction interval is wider for every x₀.

    The ratio is largest at the centre of the data. At x₀ = x̄, the ratio is √(n + 1) — for the worked example above (n = 5), that is √6 = 2.4495. As x₀ moves away from the centre, both intervals widen and the ratio shrinks toward 1, but the prediction interval never becomes as narrow as the confidence interval.

    Prediction interval vs confidence interval

    QuestionPrediction intervalConfidence interval for the mean
    What does it predict?One new observationThe population mean (or the mean response at x₀)
    Regression formulaŶ ± t* · sₑ · √(1 + 1/n + (x₀ − x̄)² / Sxx)Ŷ ± t* · sₑ · √(1/n + (x₀ − x̄)² / Sxx)
    The “1 +”Present — the new observation’s own scatterAbsent
    WidthAlways widerAlways narrower
    Use it whenYou want to predict one new valueYou want to estimate the mean

    Check: the calculator against the test matrix

    Both test rows were checked against the calculator.

    ModeInputsKey values95% prediction interval
    Regressionx = 2, 4, 6, 8, 10, 12; y = 5, 9, 11, 16, 19, 24; x₀ = 7Slope 1.8571, intercept 1.0000, sₑ 0.8018, Ŷ(7) = 14.0000[11.5955, 16.4045]
    Mean-basedx̄ = 120, s = 15, n = 12t* (df 11) = 2.2010, half-width 34.3629[85.6371, 154.3629]

    The regression row gives slope 1.8571, intercept 1.0000, sₑ 0.8018, Ŷ(7) = 14.0000 and a 95% prediction interval of [11.5955, 16.4045]. The mean-based row gives a 95% prediction interval of [85.6371, 154.3629].

    Frequently asked questions

    What is a prediction interval?

    A prediction interval is the range where a single new observation is expected to fall, with a stated confidence level — usually 95%. It is built from a regression line fitted to your data, or from a sample mean and standard deviation, and it is always wider than the confidence interval for the mean at the same point, because it must also allow for the new observation’s own scatter around the line.

    How is it different from a confidence interval?

    A confidence interval estimates the population mean — or the mean response at a given x₀ — while a prediction interval predicts one new individual value. The prediction interval’s formula has an extra “1 +” under the square root, the new observation’s own variance, so it is always wider. A confidence interval answers “where is the mean?”; a prediction interval answers “where will the next value land?”.

    Why is the prediction interval always wider?

    Because the new observation varies around the line by its own scatter, and the prediction interval must pay for that scatter. The confidence interval only carries the uncertainty in the estimated mean. Adding the “1” — the new observation’s variance — makes the prediction interval’s half-width larger for every x₀. The ratio is largest at the centre of the data (x₀ = x̄) and shrinks toward 1 as you move away, but the prediction interval never becomes as narrow as the confidence interval.

    What is the “1” under the square root?

    It is the variance of a single new observation around the regression line, measured in units of the residual variance. The rest of the term — 1/n + (x₀ − x̄)² / Sxx — is the variance of the estimated mean response. The prediction interval adds 1 for the new observation’s own deviation from that mean. Without the 1, you have a confidence interval, not a prediction interval.

    Source: the least-squares regression on this page follows the NIST/SEMATECH e-Handbook of Statistical Methods, Linear Least Squares Regression. The prediction interval formula is the standard regression textbook formula (Ŷ ± t* · sₑ · √(1 + 1/n + (x₀ − x̄)² / Sxx)).