liveBook · Manning

Residual plot

As explained in Effective Data Analysis

A residual plot is a graph of model residuals against predicted values or explanatory-variable values used to assess error patterns.

A residual plot graphs model residuals against predicted values to reveal whether errors have a consistent spread and structure. An ideal cloud appears relatively formless; visible patterns, gaps, or outliers signal assumptions or data problems requiring investigation. section 4.3.2 section 9.2.2

rats_weather["residuals"] = model.resid
rats_weather["predicted_values"] = model.predict()     #1

plt.scatter(
    rats_weather["predicted_values"],
    rats_weather["residuals"], color="gray", s=5
)     #2
plt.axhline(y=0, color="black", linestyle="-")     #3

Create the diagnostic by storing residuals and predictions, scattering predictions against residuals, and marking the zero-error line. section 9.2.2

Use the plot to investigate model quality rather than treating it as a standalone verdict:

  • Inspect uneven clouds, gaps, or extreme points for nonconstant error spread, unusual observations, or questionable records. section 9.2.2
  • Check suspicious records directly; missing weather values filled with zero produced an illegitimate low-prediction observation that was removed. section 9.2.2
  • Consider weighted least squares or transforming the dependent variable when residual spread is inconsistent. section 4.3.2

How Effective Data Analysis covers it

How deep it goes
Explains the diagnostic purpose and interpretation, then demonstrates plotting and follow-up investigation without covering residual theory in depth.
Examples
Uses daily rat-sighting predictions to identify outliers, missing weather data, and an adjusted residual plot.
What it assumes
Assumes familiarity with regression models, predicted values, and residuals while treating residual-plot diagnostics procedurally.
What you can do after
Diagnose regression problems with a residual plot and investigate whether data removal or transformation improves the model.
How it connects
Connects residual plots with linear regression, predicted values, homoscedasticity, outliers, weighted least squares, and dependent-variable transformations.

Also explained in

Compare how 3 books explain residual plot →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Effective Data Analysis. The section links point to the parts of the book it draws on.