liveBook · Manning

Heteroscedasticity

As explained in Statistics Every Programmer Needs

Heteroscedasticity is the condition that the variance of regression residuals changes systematically across levels of the predictors.

Heteroscedasticity occurs when residual variability changes systematically across predictor values instead of remaining constant. It can produce inefficient estimates, biased standard errors, and unreliable hypothesis tests or confidence intervals. section 4.2.4

Assess the assumption with a residuals plot and the Breusch–Pagan test. The test treats constant residual variance as the null hypothesis: a p-value below 5% indicates heteroscedasticity, while a larger p-value supports homoscedasticity. section 4.2.4

Testing residual variance in Python

Use `het_breuschpagan(lm.resid, lm.model.exog)` and inspect the returned p-value. A residuals plot places fitted values on the x-axis and residuals on the y-axis, helping reveal systematic changes in spread.

How Statistics Every Programmer Needs covers it

How deep it goes
Defines the assumption, explains inferential consequences, and gives visual and Breusch–Pagan diagnostics without discussing corrective methods.
Examples
Uses a fitted-values-versus-residuals plot and Python statsmodels calls for the Breusch–Pagan test.
What it assumes
Assumes a fitted regression model and residuals while defining homoscedasticity and its importance.
What you can do after
Diagnose/debug with residual plots and the Breusch–Pagan test whether constant-variance assumptions hold.
How it connects
Connects residuals, linear regression, homoscedasticity, fitted values, and the Breusch–Pagan test.

Also explained in

Compare how 4 books explain heteroscedasticity →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Every Programmer Needs. The section links point to the parts of the book it draws on.