Course contentsShow
← Data Science
Lesson 701 of 2,14518. Generalized Linear ModelsFree lesson

Deviance Residuals

Computing and interpreting deviance residuals for diagnosing model fit and identifying outliers.

Computing and Interpreting Deviance Residuals for Diagnosing Model Fit and Identifying Outliers

What you'll learn: How to use deviance residuals to diagnose problems in generalized linear models and spot unusual observations.

What Are Deviance Residuals?

In Generalized Linear Models, deviance residuals are a special type of residual that measures how much each individual observation contributes to the total deviance. Remember that deviance measures model fit—the lower, the better. Deviance residuals break this down observation-by-observation, letting you see which data points are poorly fit by your model.

Think of deviance residuals like "badness scores" for each observation. If your model were a teacher grading papers, deviance residuals tell you which students' answers most surprised the teacher based on what was expected.

Computing Deviance Residuals

For each observation i, the deviance residual is the signed square root of its contribution to the total deviance:

deviance_residual_i = sign(y_i - ŷ_i) × sqrt(deviance_contribution_i)

The sign ensures residuals are positive when observations exceed predictions and negative when below. Unlike raw residuals, deviance residuals account for the variance structure of your GLM's distribution (Poisson, binomial, etc.).

Interpreting Them for Diagnostics

Look for:

  • Large magnitude values (typically |residual| > 2 or 3): potential outliers or poorly-fit observations
  • Patterns in plots: non-random patterns suggest model misspecification (e.g., missing polynomial terms or interactions)
  • Symmetry around zero: well-specified models should show roughly symmetric deviance residuals

These residuals are especially valuable after fitting logistic or Poisson regression, where traditional residuals can be misleading due to the non-normal error structure.

Key Takeaway: Deviance residuals translate deviance into per-observation diagnostics, helping you identify outliers and assess whether your GLM assumptions hold—essential for trustworthy model interpretation.