Prediction Intervals You Can Trust
Rohan is a real-estate agent. A client walks in with a 1,500 square foot flat and asks the only question that matters: "What will it sell for?" Rohan's model gives him one number, $329,000. He could say that out loud. He would also be wrong, because almost no flat sells for exactly its predicted price. What the client actually needs is a range Rohan can stand behind.
This whole course is about turning a single guess into an honest range: an interval you can promise will contain the truth a stated fraction of the time. It starts here, with the interval your regression already knows how to build, and the quiet way that interval can betray you.
By the end of this lesson you will be able to:
- Tell a confidence interval (about the average) apart from a prediction interval (about one new outcome), and say which one a client needs
- Read a 90% prediction interval out of an
lmmodel in R, and say exactly what "90%" promises - Test whether an interval keeps that promise, and see why the textbook interval under-covers exactly when it matters most
Prerequisites: you can fit a line with lm() and you know a residual is actual minus predicted (OLS regression, regression assumptions), plus basic R (vectors, data.frame). Every new term is defined as it appears.
A point prediction is a promise you cannot keep
Let us build Rohan's market and watch the problem appear. Each lesson runs in a fresh R session, so we create the data right here (run this once). Price climbs with size at about $180 a square foot, but look closely at the noise: its spread GROWS with size, because big homes vary far more than small ones (renovations, location, a bidding war).
Now fit the line and ask it about the client's 1,500 square foot flat:
There it is: $329,113. That is the model's best single guess, and it is the model's average home at 1,500 square feet. But the client is not selling the average flat. They are selling one flat, and one flat lands somewhere in a wide cloud around that average. Quote the single number and Rohan is wrong almost every time. The honest move is to quote a range.