Prediction of a new observation uses a fitted regression to estimate a future or unused y at a chosen set of x values. That is different from reporting the estimated mean response at the same x: the mean is the average level of the line; an individual y still has extra scatter around that line.
Prediction of a new observation uses a fitted regression to estimate a future or unused y at a chosen set of x values. That is different from reporting the estimated mean response at the same x: the mean is the average level of the line; an individual y still has extra scatter around that line.
Using ŷ = 1.5 + 1.6x from the four-point teaching fit, a new x = 5 gives fitted mean 1.5 + 1.6×5 = 9.5. That 9.5 is the estimated mean response at x = 5. An individual new y at x = 5 would still vary around 9.5. x = 5 is one step beyond the observed x range 1–4, so treat it as a short extrapolation, not a guaranteed future.
| Estimated mean response | Prediction of a new observation | |
|---|---|---|
| Target | The average y at a given x | One new y at that x |
| Uncertainty | Uncertainty in the fitted line | Line uncertainty plus leftover scatter |
| Interval | Confidence interval for the mean | Prediction interval for the new y |
A prediction interval is generally wider than a confidence interval for the mean at the same x, because an individual outcome has more to explain than the average. Both intervals are model-based ranges, not promises. They typically widen as x moves away from the centre of the training x values.
Supply future x values that are realistic (next week's temperature, not an impossible calendar). For time series, also remember that autocorrelated residuals mean the leftover is not independent noise; a simple OLS prediction interval can then be too narrow.
Same constructed four points as the OLS example. Predict at x = 5. Expected display: a mean near 9.5 and a summary that includes a mean confidence interval and a prediction interval. The prediction interval should be the wider of the two. Do not copy invented printed bounds into an answer booklet.
In statsmodels, mean_ci_* refers to the mean response
and obs_ci_* to the new observation. Compare those two
widths on your own run.