In this chapter, we study how to assess whether a fitted linear regression model is adequate. After learning estimation, inference, ANOVA, and interpretation, we now turn to model checking. The main tools are residuals, diagnostic plots, and numerical measures that help identify nonlinearity, unequal variance, outliers, and influential observations.
Learning Objectives
By the end of this chapter, students should be able to:
explain why model diagnostics are necessary after fitting a regression model;
define raw, standardized, and studentized residuals;
interpret residual plots for common types of model failure;
distinguish between outliers in the response direction and influential observations in the design space;
use leverage, Cook’s distance, and related diagnostics;
assess model adequacy using graphical and numerical tools.
Reading
Recommended reading for this chapter:
Seber and Lee:
sections on residual analysis
diagnostics for regression models
influence and unusual observations
Montgomery, Peck, and Vining:
sections on residuals
diagnostic plots
outliers, leverage, and influence
Why Diagnostics Matter
A fitted regression model may look statistically significant and still be inappropriate. For example:
the relationship may not be linear;
the error variance may not be constant;
the error distribution may be strongly non-normal;
a small number of unusual observations may dominate the fit.
So regression analysis does not end when we obtain estimates and \(p\)-values. We must also ask whether the model assumptions are reasonable and whether the fit is being driven by problematic observations.
A residual measures how far an observed response is from the fitted value at that observation. Residuals are the basic raw material of regression diagnostics.
ImportantResiduals are not the true errors
Residuals are not the same as the true errors. The true model error is
Its diagonal entries \(h_{ii}\) are called leverages. Under the standard model,
\[
\mathrm{Var}(e_i) = \sigma^2(1-h_{ii}).
\]
So residuals do not all have the same variance. Observations with high leverage tend to have smaller residual variance. This is why raw residuals alone can be misleading.
Standardized Residuals
A common adjustment is to divide each residual by its estimated standard deviation. The standardized residual is
This puts residuals on a comparable scale across observations. Large absolute values of \(r_i\) may indicate unusual observations in the response direction.
Studentized Residuals
A more refined version is the studentized residual. One version uses the variance estimate computed from the full model. Another version uses the variance estimate obtained after deleting the \(i\)th observation. The externally studentized residual is often written as
where \(\hat{\sigma}_{(i)}^2\) is the residual variance estimate from the model fit without observation \(i\). These are especially useful for outlier detection.
8.2 Diagnostic Plots
One of the most important diagnostic plots is the plot of residuals versus fitted values. This plot helps detect:
nonlinearity;
unequal variance;
outliers;
missing structure.
A good residual plot usually shows points randomly scattered around zero with roughly constant spread. Patterns are warning signs.
Interpreting Common Patterns
If the residual plot shows a curved pattern, that suggests the mean function may not be adequately linear. If the spread of residuals increases or decreases with the fitted values, that suggests heteroscedasticity, meaning nonconstant error variance. If a few points are isolated far from the rest, they may be outliers or influential observations. Thus the residual plot is often the first and most important diagnostic tool.
Residuals Versus Individual Predictors
It is often helpful to plot residuals against each predictor separately. A residual-versus-predictor plot can reveal:
nonlinearity in that predictor;
different spread across ranges of the predictor;
group-specific patterns;
possible interactions not included in the model.
These plots are often more informative than a single omnibus diagnostic.
Normal Q-Q Plot
The normal Q-Q plot is used to assess whether the residual distribution is approximately normal. If the normality assumption is reasonable, the residual points should fall approximately along a straight line. Departures from linearity suggest:
skewness;
heavy tails;
light tails;
extreme outliers.
Normality matters most when sample size is small and exact \(t\) and \(F\) inference is important.
Histogram of Residuals
A histogram of residuals can also be useful, though it is usually less informative than a Q-Q plot. It may reveal:
skewness;
multimodality;
heavy tails;
extreme asymmetry.
However, the histogram depends strongly on bin choices, so it is usually used as a supplementary plot rather than the main normality diagnostic.
Scale-Location Plot
A scale-location plot often displays \(\sqrt{|r_i|}\) against fitted values. This is another way to assess whether the variance is approximately constant across the fitted range. A roughly horizontal band is desirable. A systematic increase or decrease suggests heteroscedasticity.
Outliers
An outlier is an observation whose response value is unusual relative to the fitted model. In regression, an observation can be outlying in the response direction even if its predictor values are not unusual. Large residuals or large studentized residuals often indicate potential outliers. However, not every outlier is influential.
Leverage
Leverage measures how unusual an observation is in the predictor space. The leverage of observation \(i\) is \(h_{ii}\). High leverage points are far from the center of the predictor cloud in a geometric sense. These points have greater potential to affect the fitted regression line or plane. A rough rule of thumb is that leverage values substantially larger than
may deserve attention, where \(p\) is the number of parameters including the intercept. These are only rough guidelines, not formal cutoffs.
Outlier Versus High-Leverage Point
It is important to distinguish between:
a point with a large residual;
a point with high leverage.
A point can have:
low leverage and large residual;
high leverage and small residual;
both high leverage and large residual.
The last case is often the most concerning because such a point may strongly influence the fitted model. For additional coefficient-specific and partial-regression diagnostics, see Optional linear-model extensions.
8.3 Influence
An observation is influential if removing it changes the fitted model noticeably. Influence depends on both:
how unusual the response is;
how unusual the predictor values are.
So influential points often combine high leverage with a sizable residual. Influence is not the same as being an outlier.
Cook’s Distance
One of the most widely used influence measures is Cook’s distance. Cook’s distance for observation \(i\) measures how much the fitted values change when observation \(i\) is removed. A common formula is
Large values of \(D_i\) indicate potentially influential observations. Plots of Cook’s distance help identify observations that deserve closer inspection.
Diagnosing Nonlinearity
If the mean function is nonlinear but we fit a linear model, residual plots may show curvature. Possible remedies include:
adding polynomial terms;
applying transformations;
including interactions;
using a different modelling framework.
Diagnostics should not be viewed only as fault-finding. They also guide model improvement.
Diagnosing Heteroscedasticity
If the error variance is not constant, residual plots may show a funnel shape or other changing spread. Possible remedies include:
transforming the response;
weighted least squares;
modelling the variance structure explicitly;
using heteroscedasticity-robust standard errors in some contexts.
At this stage, the main goal is to recognize the pattern and understand its consequences.
Diagnosing Non-Normality
If residuals are strongly non-normal, this may affect exact small-sample inference. Possible causes include:
skewed responses;
heavy-tailed errors;
outliers;
omitted structure.
Possible remedies include:
transformation;
alternative modelling assumptions;
robust procedures;
careful interpretation if sample size is large and inference is approximately stable.
Diagnostics Are Contextual
There is no single diagnostic that automatically declares a model valid or invalid. Instead, diagnostics require judgment. Students should ask:
Is the pattern strong or mild?
Is it scientifically meaningful?
Does one point dominate the fit?
Would conclusions change if the model were modified?
Is the issue important for the goal of the analysis: explanation, prediction, or inference?
Worked Example With an Outlying Observation
Consider the data \(x = (1,2,3,4,5,6,7,8)\), and \(y = (2,4,5,8,10,11,13,25)\). The final observation may look unusual because the response jumps upward relative to the earlier trend. If we fit a simple linear regression, we should examine:
the scatterplot with fitted line;
residuals versus fitted values;
studentized residuals;
leverage;
Cook’s distance.
This is a good example for discussing the difference between an outlier and an influential point.
Figure 8.1: Eight observations and the fitted line. The observation at x = 8 motivates a closer look at residuals and influence.
Residual plots with ggplot2
The helper below uses ggplot2 for the plots and patchwork to arrange them. Install patchwork once with install.packages("patchwork") if needed. It draws residuals versus fitted values, a normal Q-Q plot, a scale-location plot, and standardized residuals versus leverage. The last panel includes Cook’s-distance contours; labels identify the three observations with the largest Cook’s distances. For weighted least squares, the first panel uses residuals multiplied by the square root of their weights. The other panels use standardized residuals computed for the fitted model.