liveBook · Manning

Heteroscedasticity

As explained in Effective Data Analysis

Heteroscedasticity is the condition in which the spread of residuals varies across the range of predicted or explanatory values.

Heteroscedasticity occurs when residuals do not have a consistent spread across predicted values. A residual plot should look like an even cloud around zero; visible shapes or trends suggest uneven prediction accuracy. section 9.1.2

Diagnose and respond to inconsistent residual spread by:

  • Plotting residuals against predicted values and checking for patterns, trends, or changing spread. section 9.1.2
  • Checking a residual histogram; linear regression residuals are expected to be normally distributed. section 9.1.2
  • Reviewing whether the formula is appropriate, removing erroneous extreme outliers, and considering missing explanatory variables. section 9.1.2
housing_prices["residuals"] = model.resid
housing_prices["predicted_values"] = model.predict()     #1

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

Use the residual-versus-predicted-values listing to reproduce the central diagnostic plot for a housing-price regression. section 9.1.2

How Effective Data Analysis covers it

How deep it goes
Explains visual and histogram checks plus corrective responses, without developing formal heteroscedasticity tests.
Examples
Uses housing-price predictions, residual scatterplots, and residual histograms as diagnostic examples.
What it assumes
Assumes residuals, predicted values, and linear regression as the working analytical context.
What you can do after
Diagnose/debug with it by plotting residuals, recognizing uneven accuracy, and revising the model.
How it connects
Connects residuals, predicted values, linear regression, normal distribution, outliers, and nonlinear relationships.

Also explained in

Compare how 4 books explain heteroscedasticity →

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.