Prediction Interval Calculator
A fitted line gives one number at a new x, but two different questions hide behind it: where will one new observation land, and where does the average outcome sit? Paste your x and y, pick a new x, and this page answers both at once: the prediction interval and the confidence interval, same centre, drawn to scale so the gap between them is impossible to miss. Everything runs in your browser.
One row per point. Commas, tabs or spaces all work, and a header row is fine.
-
That highlighted 1 is the whole difference: the variance of the new point's own noise.
Everything else is identical, which is why both intervals share the same centre. The prediction interval carries one extra term: a lone 1 under the square root, standing for the variance of the future point's own error. The other two terms shrink as you gather more data, so the confidence interval collapses onto the line. That 1 never shrinks, so the prediction interval stays wide no matter how big your sample gets.
Choosing between them: if your sentence is about one specific case, use the prediction interval. If it is about the average at that x, use the confidence interval.
How this is computed
✓ No data leaves your browser
✓ Verified against R's predict() and lm()
✓ Free, no sign-up
Which interval answers your question?
Both are centred on the same fitted value. Only the width differs, and the width is the whole answer.
| Your question | Interval | Why |
|---|---|---|
| What will this one student score after 6.5 hours? | Prediction | One future case carries its own noise on top of the line's uncertainty. |
| What is the average score of everyone who studies 6.5 hours? | Confidence | Averages cancel individual noise, so only the line's uncertainty is left. |
| What tolerance should I quote for the next batch? | Prediction | A tolerance is a promise about individual units, not about a long-run mean. |
| Is the true mean at this x above a threshold? | Confidence | The claim is about a population mean, which is what the CI covers. |
| How much does y change per unit of x? | Neither: use the slope CI | That is a question about the coefficient. The linear regression calculator gives the slope with its interval. |
Why both bands pinch at the mean of x
Both widths contain the term (x0 - xbar)² / Sxx. At the mean of x that term is exactly zero, and it grows the further out you go, in either direction. The reason is mechanical: the least squares line always passes through the point (xbar, ybar), so it pivots there like a see-saw. A small error in the estimated slope barely moves the line near the middle, but swings it further and further as you travel toward the edges. Drag the slider above and watch both bands flare out symmetrically. That bow-tie shape is the picture of that pivot.
The confidence band gets narrow at the centre because it only carries the line's own wobble. The prediction band never gets narrow, because even a perfectly known line cannot tell you where one noisy new point will land. As n grows, the confidence band shrinks toward the line while the prediction band settles at roughly ± t × s and stops.
Extrapolation: where these intervals quietly lie
Push x₀ past the edge of your data and this page flags it. The arithmetic keeps working, and the intervals even keep widening, which makes them look suitably humble. They are not. Both formulas assume the straight line you fitted is the true relationship, and they only price in noise around that line. Outside the observed range of x, nothing in your data tests that assumption. If the true relationship bends, plateaus, or reverses out there, the real error is not covered by any of these terms. Treat an extrapolated interval as a floor on your uncertainty, never a bound.
Questions people ask
What is the difference between a prediction interval and a confidence interval?
Both sit at the same centre, the fitted value at x₀, but they cover different things. The confidence interval covers the mean response: where the regression line itself really sits at that x. The prediction interval covers one new individual observation at that x. The single new point brings its own noise on top of the uncertainty in the line, so its interval is always wider.
Why is the prediction interval always wider?
Compare the two standard errors. The mean response uses s × sqrt(1/n + (x0-xbar)²/Sxx). A single new observation uses s × sqrt(1 + 1/n + (x0-xbar)²/Sxx). That leading 1 is the variance of the new point's own error term, and it is always positive, so the prediction interval cannot ever be narrower.
Does the prediction interval shrink if I collect more data?
Only so far. As n grows, both 1/n and (x0-xbar)²/Sxx head toward zero, so the confidence interval collapses onto the line and can get arbitrarily narrow. The prediction interval converges to about ± t × s and stays there. More data pins down where the line is. It does not make an individual outcome any less variable.
Why are both intervals narrowest at the mean of x?
Because the shared term (x0-xbar)²/Sxx is zero at the mean and grows in both directions. The fitted line pivots around (xbar, ybar), so slope error hardly moves it at the centre but swings it hard at the edges. Both bands therefore look like a bow tie pinched in the middle.
What happens if my new x is outside the range of my data?
You are extrapolating, and this page says so. The interval still computes, but it understates the real uncertainty: it only accounts for noise around a straight line you have assumed continues unchanged. Nothing in your data tests whether it does. An extrapolated interval is a lower bound on how wrong you might be, not a bound.
How do I get these intervals in R?
Fit the model, then call predict() twice on the same new data: interval = "prediction" for one new observation, interval = "confidence" for the mean response. Add level = 0.99 to change the level. The live code block above writes both calls out with your numbers already in them.
Which interval should I put in my report?
Ask what your sentence is about. One specific future case (this patient, this batch, next month's order) needs the prediction interval. A typical or average outcome at that x needs the confidence interval. Quoting a confidence interval when your reader is about to act on a single case is the most common way this goes wrong, and it makes you look far more certain than you are.
Do these intervals assume anything about my data?
Yes, and the prediction interval leans on the assumptions harder. Both assume the relationship is linear, the errors are independent, and their spread is constant across x. The prediction interval also assumes the new point's error is normally distributed, because it is describing one draw rather than an average, and averages get help from the central limit theorem that a single point does not. If your residuals are skewed or fan out, check them with the diagnostic plot interpreter first.
Go deeper
The neighbouring tools and the tutorials behind this one.