Residual plotWhat a model got wrong, point by point.
For every case, real minus predicted, around a line at zero. Random scatter means the model is fine; any shape means it misses something.
- Answers Is the model any good?
- Your data predicted and actual value per case
- Cases about 20 to 10,000
- Good sign no pattern around zero
- Excel and Power BI a scatter chart
What is a residual plot?
A residual plot checks a model that predicts numbers, such as prices or sales. For every case, the residual is the real value minus the prediction: above zero, the model guessed too low; below, too high. The plot puts the prediction across and the residual up, around a line at zero. A good model leaves a shapeless cloud; a curve, a funnel or a cluster means the model misses something, and a point far from the rest is worth a closer look.
A model predicting house prices, checked on 16 houses (in thousands of euros). The errors scatter evenly within about 38 thousand either way, except house 7, which sold for 62 thousand more than predicted.
Why use a residual plot?
Because a model's average error hides where it goes wrong.
- Patterns show. A curve or funnel in the errors is a missed effect.
- Outliers stand out. One case far from zero is easy to spot.
- Fairness check. Errors as big for cheap houses as for dear ones?
- Before trusting a model. The standard check after fitting.
How does a residual plot work?
Four steps build a residual plot.
- Step 1 of 4Predicted against actualEach house: prediction across, real price up; perfect predictions sit on the diagonal.
- Step 2 of 4SubtractReal minus predicted for each house, around a line at zero.
- Step 3 of 4Add a bandTwo standard deviations either side: most errors should fall inside.
- Step 4 of 4Name the outlierHouse 7 sold 62 thousand above its prediction.
What are the parts of a residual plot?
Four parts, and each one has a job.
- Zero linewhere a perfect prediction sits
- Residualone case's error
- Bandthe usual size of errors
- Outlieran error far bigger than the rest
How do you read a residual plot?
Three looks, in this order.
- Look for a shapeNo curve, no funnel: errors look random across all prices.
- Check the balanceAbout as many points above zero as below: no lean either way.
- Find the outliersHouse 7, +62: a garden, a view, something the model does not know.
What kinds of residual plot are there?
The same houses, three ways.
- Kind 1Residuals with a bandThe usual check.
- Kind 2Residuals onlyWithout the band.
- Kind 3Actual against predictedThe diagonal is perfect.
Residuals can also be plotted against time (do errors drift?), against an input (is the model wrong for big houses only?), or in a histogram (are errors symmetric?).
When should you use a residual plot?
When a model predicts numbers and you want to know if it can be trusted.
- a model predicts amounts (prices, sales, demand)
- you want to find patterns the model misses
- outliers matter
- you compare model versions
- the model predicts classes (a confusion matrix or ROC curve)
- only the overall error matters (a single number such as MAPE)
- there is no model, just data (a scatter plot)
Residual plot or actual against predicted?
Errors made big, or the whole picture.
Actual against predicted looks reassuring: all houses hug the diagonal, because prices from 150 to 450 dwarf the errors. The residual plot takes the diagonal away and blows the errors up, so house 7 and the size of the usual error become plain.
How do you make a residual plot?
Predicted and actual per case, in Excel, Power BI or Python.
In Excel, add a column actual minus predicted and draw a scatter chart with the prediction on x and the residual on y; the regression tool in the Analysis ToolPak can also output residual plots. In Power BI, a measure for the residual and a scatter chart do it, with a constant line at zero. For one number to go with it, see forecast accuracy.
What goes wrong with residual plots?
The most common mistake, and its fix: missing a funnel.
- look whether the cloud widens to one side
- if so, model the log of the price or report errors in percent
| Mistake | Why it hurts | Fix |
|---|---|---|
| Missing a curve | The model misses a bend | Add the missing term |
| Missing a funnel | Errors grow with size | Log scale or percent errors |
| Deleting outliers | The model learns less | Find out why first |
| Residuals on training data only | Looks better than it is | Held-out data too |
| No zero line | Above and below are hard to see | Draw it |
Every chart for “Is the model any good?”
Read on, step by step.
Does it fit your data? Try it.
Paste your table into Chart Compass, say what the chart should show, and see the charts that fit, drawn with your own numbers. It runs in your browser, so the data stays with you.