skip to content

Prediction Intervals

A fitted line predicts an average, and the band around one brand-new observation is far wider than the band around that average. Interviewers ask which one a stakeholder actually needs.

on this pageshow

questions

5

Why is a regression prediction unreliable at a predictor value far outside the observed data range?

level: juniorimportance: must knowfreq 58%

answer

  1. check the range the model actually saw
  2. the formula never refuses an input
  3. the interval widens but stays finite
  4. linearity is assumed out there, not tested
  5. diminishing returns break the straight line

basics

~20 s

Nothing in the data supports the model's shape out there. The arithmetic still prints a number and a finite interval, but that interval covers only sampling error under an assumed straight line, not the risk that the true relationship bends.

solid answer

~50 s

A fitted line is evidence about the range of predictor values you actually observed. Beyond that range you are asserting, not measuring, that the same straight-line relationship continues. The formula never objects: feed a model trained on ad spends of 5k to 50k an input of 500k and it will happily return a fitted value and an interval around it. The interval does widen, because the leverage term `(x0 - xbar)^2 / Sxx` grows with squared distance, but it prices only sampling error *conditional on the linear form being correct* — and the linear form is exactly what fails first, since spend almost always saturates. Two practical guards: sanity-check the output against domain limits (a predicted conversion rate above 1, a negative duration), and record the training range for each predictor so scoring can flag out-of-range inputs rather than silently answering.

go deeper

for a junior

Remember to check the range of the data the model was fitted on before quoting a prediction, and to say plainly that the model gives no evidence about inputs it never saw.

for a middle

Explain why the widening interval is not a safeguard: it prices sampling error under an assumed form, with no term for the form itself being wrong beyond the observed range.

for a senior

Show the operational habit: store the training range with the model, flag out-of-range scoring inputs, and note that in multiple regression an unusual combination extrapolates even when each column passes its own range check.

for a principal

Own the policy question of whether the organisation is allowed to act on out-of-range predictions at all, and what has to accompany one — an explicit label, a stated assumption, or a decision to fund data collection in that region first.

## The claim a fitted line actually supports A regression estimates the relationship between predictors and response **over the region the data covers**. If every observed ad spend lies between 5,000 and 50,000, the fit is evidence about that band and nothing else. Asking the model about 500,000 is asking a question the data never addressed. The uncomfortable part is that the model answers anyway. `y_hat = b0 + b1 * 500000` is a perfectly well-defined piece of arithmetic. There is no error, no warning, no missing value. The number looks exactly like the numbers that came from inside the data range, and it flows into a slide deck looking equally authoritative. ## Why the widening interval does not save you A reasonable objection: prediction intervals get wider as you move away from the centre of the data, so surely the interval will blow up and warn me? It widens, but not nearly enough, and not for the right reason. The half-width for a new case is `t * s * sqrt( 1 + 1/n + (x0 - xbar)^2 / Sxx )` The leverage term does grow with the squared distance from the predictor mean, so far-out predictions do carry wider intervals. But two things limit how much comfort that provides: - **The growth competes with a leading `1`.** For the prediction interval the leverage term is added to `1`, so even a large leverage value changes the width by a modest factor rather than exploding it. - **It prices the wrong risk.** Every term in that formula is derived *assuming the straight-line model is correct*. It quantifies how much the estimated coefficients might be off. It contains no term at all for "the relationship is not actually a straight line out here." That risk is unbounded and unmeasured. So the honest statement is: the interval covers sampling error under an assumption, and the assumption is the thing that is failing. ## What typically breaks Real relationships are usually locally close to linear and globally not. The ad-spend case is the canonical one: within the observed band, extra spend buys roughly proportional extra conversions; ten times beyond it, you have exhausted the addressable audience and the curve flattens hard. A straight line extrapolated into that region overpredicts, sometimes wildly. Other common breakages: - **Physical or logical limits.** A linear model can predict a negative delivery time for a distance of zero, a conversion rate above 100%, or a headcount of 2.4 million. The prediction is not merely uncertain; it is impossible. - **Regime changes.** The mechanism that generated the data may not be the mechanism operating at the new input — different customer segment, different capacity constraints, different pricing tier. - **Predictor combinations that never co-occurred.** In multiple regression, every individual predictor can be inside its own observed range while the *combination* is one the data never contained. The model is extrapolating even though no single input looks unusual. That last one is the version that catches experienced people, because a per-column range check passes cleanly. ## What to do instead - **Record the training range.** Store the minimum and maximum of each predictor at fit time, and have scoring flag or refuse inputs outside it rather than answering silently. - **Label out-of-range predictions.** If the business genuinely needs a number at 500k spend, deliver it marked as an extrapolation with an explicit statement that the interval does not cover model risk. - **Sanity-check against domain limits.** Compare the prediction against known bounds — total addressable market, physical minimums, a probability that must live in 0 to 1. - **Get data out there, or change the model.** The only real fixes are observing the region you care about, or choosing a functional form with the right shape — one that saturates rather than rising forever. Both are decisions to make deliberately, not defaults to fall into. ## The one-sentence version Inside the observed range a regression interpolates between things you have seen; outside it, the same arithmetic extrapolates an assumption you have never tested, and the interval it prints prices only the first kind of uncertainty.

  • Does the widening prediction interval protect you from extrapolation?
    No. Every term in the interval formula is derived assuming the fitted form is correct, so it prices coefficient uncertainty and individual noise but carries no term for the model being the wrong shape. Out beyond the data that is the dominant risk, and it is exactly the one the interval leaves out.
  • In a multiple regression, can you be extrapolating even when every predictor is inside its own observed range?
    Yes, and this is the version that slips through. If two predictors were strongly related in the training data, a row combining a high value of one with a low value of the other may sit in a region the data never covered, even though each column passes a min-max check. Guarding needs the joint region, not per-column ranges.
  • What is a cheap guard to put in a scoring path?
    Record each predictor's observed minimum and maximum at fit time and store them alongside the model, then have scoring flag any input outside that range instead of returning a number silently. Pair it with a domain sanity check — reject predicted probabilities above one, negative durations, or values beyond a known market size.

Measuring a child's height every month and drawing a straight line through it fits beautifully — and predicts a three-metre adult. The line was never wrong about the data; it was wrong about where the data stopped.

saying these in an interview costs you the question

  • Trusts a far-out prediction because the interval still looks narrow
  • Assumes a fitted straight line holds at any input value
  • Says a high goodness-of-fit score makes extrapolation safe
  • Expects the model to warn when an input is out of range
  • Ignores that ad spend and similar drivers saturate

context

open as a page

In regression, how does a prediction interval differ from a confidence interval for the mean response?

level: middleimportance: must knowfreq 72%

basics

~20 s

A confidence interval for the mean response covers the average outcome at a given predictor value. A prediction interval covers one new individual case, so it is always wider: it adds the irreducible spread of a single observation.

open as a page

What is the residual standard error in a fitted regression, and what are its degrees of freedom?

level: middleimportance: should knowfreq 50%

basics

~20 s

The residual standard error estimates typical error size around a fitted line: the root of the residual sum of squares over n minus the number of estimated coefficients. With 4 predictors plus an intercept, that divisor is n - 5.

open as a page

A manager treats your model's point prediction of 42 minutes as a promise — how do you respond?

level: seniorimportance: should knowfreq 40%

basics

~20 s

Replace the single number with an interval and say what it covers: the best estimate is 42 minutes, and about 95 of 100 individual orders like this land between 27 and 57. Then agree which number the promise uses.

open as a page

Why does a regression prediction interval widen as the predictor moves away from its sample mean?

level: middleimportance: nice to knowfreq 34%

basics

~20 s

The fitted line is pinned most tightly at the centre of the data. The interval carries a leverage term growing with squared distance from the predictor's mean, so the band is a bow tie: narrowest at the mean, flaring at both ends.

open as a page