Skip to content
Omnikalc

Prediction interval calculator: how far can a new observation be from the regression line?

Enter the regression summary and a new x to get the confidence interval for the mean response and the prediction interval for a single new observation.

Updated on
Your inputs

Value out of range

Value out of range

Value out of range

Value out of range

Value out of range

Value out of range

Results

Prediction interval for a new observation: lower

45.69

Prediction interval for a new observation: upper

59.11

Critical t value
2.074
Standard error of the mean response
0.921
Confidence interval for the mean response: lower
50.49
Confidence interval for the mean response: upper
54.31
Standard error of a new observation
3.234

A regression line gives one predicted value, but a prediction should come with a range. The regression prediction interval calculator takes the number of observations, the mean of x, Sxx, the residual standard error, a new x, its predicted y and a confidence level, and gives the confidence interval for the mean response and the prediction interval for a new observation.

How the calculation works

  • From your simple linear regression, take the number of observations n, the mean of x, the sum of squared deviations Sxx = Σ(x − x̄)² and the residual standard error s.
  • Compute the leverage term at the new point: 1 ÷ n + (x₀ − x̄)² ÷ Sxx. It grows as x₀ moves away from the mean of x.
  • The standard error of the mean response is s × √(leverage term), and the standard error of a new observation is s × √(1 + leverage term).
  • Each interval is the predicted value ± t(1 − α ÷ 2; n − 2) times its standard error. The prediction interval is always wider than the confidence interval.

Example

A regression on 24 points has x̄ = 14.2, Sxx = 310 and a residual standard error of 3.1. At x₀ = 18 the model predicts 52.4. The leverage term is 1 ÷ 24 + 3.8² ÷ 310 = 0.0883. The critical t at 95 % with 22 degrees of freedom is 2.074. The standard error of the mean response is 0.921, which gives a confidence interval of 50.49 to 54.31. The standard error of a new observation is 3.234, which gives a prediction interval of 45.69 to 59.11.

Why it matters

Forecasts in sales, engineering and science are more useful with an honest range. The prediction interval tells you where a single future value is likely to fall, which is what planners and quality engineers usually need.

Good to know

The formulas assume the usual linear model: a straight-line relationship, independent errors with constant variance, and roughly normal residuals. They apply to a simple regression with one predictor. If the residuals show a pattern or fan out, the intervals will be too narrow in some places and too wide in others.

The linear regression calculator fits the line, and the confidence interval calculator covers intervals for means.

Frequently asked questions

What is the difference between a confidence interval and a prediction interval?

The confidence interval covers the average value of y at the new x and shrinks as the sample grows. The prediction interval covers a single new observation, which also has its own random scatter around the line, so it stays wide even with lots of data.

Why does the interval get wider away from the mean of x?

The line is best known near the center of the data. Far from the mean, a small error in the slope has a large effect on the predicted value, so the uncertainty grows. That is the role of the squared distance term.

Where do I find Sxx and s?

Both come from the regression output. s is the residual standard error, or the square root of the mean squared error. Sxx can be found as (n − 1) times the variance of x, or from the standard error of the slope: Sxx equals s squared divided by the squared standard error of the slope.

Can I predict far outside my data?

It is risky. The formulas only measure sampling error, not the chance that the relationship changes outside the range you observed. A prediction far beyond the data can be badly wrong even when its interval looks reasonable.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.