01 / 21

Residuals &
Diagnostics

Learn how residuals reveal the quality of a regression model and how diagnostic plots help you identify outliers, leverage, and influential points.

Business Statistics

What Is a Residual?

A residual is the vertical distance between an observed data point and the regression line. It measures how far the model's prediction misses the actual value:

A positive residual means the point sits above the line. A negative residual means it sits below. If a model fits well, residuals should be small and show no pattern.

Visualizing Residuals

x y Positive residual Negative residual

Why Residuals Matter

Model Fit
Large residuals signal the model is missing important patterns in the data.
Assumptions
Residual plots check linearity, constant variance, and normality assumptions of regression.
Outliers
Unusually large residuals flag observations that deviate strongly from the trend.

In business decisions, a model with patterned residuals can lead to biased forecasts and poor resource allocation. Diagnostics catch these issues before they cost money.

The Residual Formula

1
\( y_i \): the actual observed value of the response variable for observation \( i \).
2
\( \hat{y}_i \): the predicted value from the regression line at \( x_i \).
3
\( e_i \): the residual, capturing everything the model cannot explain.

Standardized Residuals

Raw residuals are hard to compare across observations because different points have different expected variability. We standardize them:

Residual vs. Fitted Plot

Fitted values Residuals Random scatter: assumptions met

Problem Patterns in Residuals

Curved Pattern
Residuals form a U-shape or arch: the relationship is nonlinear. Consider a polynomial or transformation.
Fan Shape
Residuals spread out (or narrow) as fitted values grow: heteroscedasticity. Variance is not constant.
Clusters
Distinct groups of residuals suggest a lurking variable or subpopulation the model does not account for.

Outliers vs. Leverage vs. Influence

Outlier High Leverage Influential
Definition Large residual in \( y \) Extreme in \( x \) Changes the fit when removed
Detected by Standardized residual Leverage \( h_{ii} \) Cook's Distance
Threshold \( |z_i| > 2 \) \( h_{ii} > \frac{2p}{n} \) \( D_i > 1 \)
Always bad? Not necessarily Not necessarily Investigate carefully

Leverage and Cook's Distance

x y Outlier (large residual) High leverage Influential point Pulled line

Cook's Distance Formula

1
\( e_i \): the residual for observation \( i \).
2
\( h_{ii} \): the leverage of observation \( i \), measuring how extreme its \( x \)-value is.
3
\( p \): number of parameters (including intercept), and MSE is the mean squared error.

How to Diagnose a Regression

1
Fit the model and compute residuals \( e_i = y_i - \hat{y}_i \).
2
Plot residuals vs. fitted values. Look for curves, fans, or clusters.
3
Check normality with a histogram or Q-Q plot of the residuals.
4
Standardize residuals and flag any with \( |z_i| > 2 \) as potential outliers.
5
Calculate leverage \( h_{ii} \) and Cook's Distance \( D_i \) to assess influence.
6
Decide: re-fit without the point, transform variables, or add predictors as needed.

Example 1: Computing a Residual

A company models monthly sales (\( y \), in thousands) from ad spending (\( x \), in thousands). The regression equation is:

In one month, the company spent \( x = 8 \) thousand on ads and observed \( y = 45 \) thousand in sales. Find the residual.

1
Predicted: \( \hat{y} = 12 + 3.5(8) = 12 + 28 = 40 \)
2
Residual: \( e = 45 - 40 = \) \( +5 \)

Example 2: Standardized Residual

Using the same model with \( s_e = 4.2 \) (residual standard error from 20 observations), is the observation from Example 1 an outlier?

1
Standardize: \( z = \dfrac{e}{s_e} = \dfrac{5}{4.2} \approx 1.19 \)
2
Compare: \( |1.19| < 2 \), so this is not an outlier.

Example 3: Identifying Influence

A new observation has \( x = 25 \) (far beyond the data range of 2 to 12) and \( y = 60 \). The model predicts \( \hat{y} = 99.5 \). With \( h_{ii} = 0.42 \), \( p = 2 \), and \( \text{MSE} = 17.64 \):

1
Residual: \( e = 60 - 99.5 = -39.5 \)
2
Cook's Distance: \( D = \dfrac{(-39.5)^2}{2 \times 17.64} \cdot \dfrac{0.42}{(1 - 0.42)^2} = \dfrac{1560.25}{35.28} \cdot \dfrac{0.42}{0.3364} \approx 44.2 \times 1.25 \approx 55.2 \)
3
Verdict: \( D = 55.2 \gg 1 \). This is extremely influential.

Common Mistakes

✕ Deleting all outliers
Not every outlier should be removed. Only remove if there is a clear data error or justification: outliers sometimes carry real information.
✕ Ignoring residual plots
A high \( R^2 \) does not mean the model is good. Always check residual plots for patterns before trusting predictions.
✕ Confusing leverage with influence
High leverage alone is not a problem. A point needs both extreme \( x \) and a large residual to be truly influential.

Diagnostic Summary

Tool What It Checks Red Flag
Residual Plot \( e_i \) vs. \( \hat{y}_i \) Linearity, constant variance Curves or fans
Q-Q Plot Normal quantiles Normality of residuals Deviations from diagonal
Standardized Residual \( z_i = e_i / s_e \) Outliers in \( y \) \( |z_i| > 2 \)
Leverage \( h_{ii} \) Extreme \( x \)-values \( h_{ii} > \frac{2p}{n} \)
Cook's Distance \( D_i \) Overall influence \( D_i > 1 \)

Question 1 of 5

A regression model predicts \( \hat{y} = 50 \) for an observation where the actual value is \( y = 42 \). What is the residual?

Question 2 of 5

A residual vs. fitted plot shows a clear U-shaped curve. This indicates:

Question 3 of 5

An observation has a standardized residual of \( z = 2.8 \). This means the observation is:

Question 4 of 5

Which measure combines leverage and residual size to assess a single observation's overall effect on the regression?

Question 5 of 5

In OLS regression, the sum of all residuals \( \sum e_i \) equals: