Applied Regression Analysis: Residual Diagnostics

Discussion Forum: Visual Inspection for Heteroscedasticity

The Visual Inspection Problem

When inspecting a scatterplot, subtle error patterns are easy to miss:

  • Lower Fitted Values: Wide vertical spread (high variance).
  • Higher Fitted Values: Spread contracts sharply near zero (low variance).

Without visual frameworks, it is easy to miss this changing variance (heteroscedasticity) and accept a flawed OLS model.

Raw Residuals vs Fitted

Figure 1

Method 1: The Envelope

Connecting the 5th and 95th percentiles highlights the macro-structure of the variance. If the lines are not parallel, variance is not constant.

Figure 2

jamovi: The Envelope Method (Approximation)

jamovi does not natively draw quantile boundaries, but you can approximate the upper half of the envelope by plotting the absolute magnitude of the residuals.

1. Save Model Outputs In Analyses > Regression > Linear Regression, under the Save menu, check Residuals and Predicted values.

2. Compute Absolute Residuals Go to the Data tab. Select Compute to create a new variable named Abs_Resid. Use the formula (\(f_x\)): ABS(Residuals).

3. Plot with a Trend Line Navigate to Analyses > Exploration > Scatterplot.

  • Place Predicted values on the X-axis and Abs_Resid on the Y-axis.
  • Under Regression Line, select Smooth.

If this smoothed line trends upwards or downwards, the outer boundary of your variance is expanding or contracting, indicating heteroscedasticity.

Method 2: Vertical Slicing

Divide the horizontal axis into quantiles (e.g., thirds) to directly compare variance ranges across different segments of the data.

Figure 3

jamovi: Slicing Residuals by Tercile

To apply the Vertical Slicing method mechanically in jamovi without visual guessing, follow these steps:

1. Save Model Outputs Navigate to Analyses > Regression > Linear Regression. Run your model. Under the Save menu, check the boxes for both Residuals and Predicted values.

2. Find Quantile Cut-Points Navigate to Analyses > Exploration > Descriptives. Move your newly saved Predicted values variable into the variables box. Expand Statistics, check the Percentiles box, and type 33, 66 to find the exact cut values for thirds.

3. Create the Slicing Variable Navigate to the Data tab. Select Compute to create a new variable (name it Tercile). Use a nested IF function (field \(f_x\)) to assign the bins based on the percentiles you found in Step 2 (replace [33rd_percentile_value] and [66th_percentile_value] with the values from Step 2; in ex. 10: \(46.9\), and \(56.7\), respectively): IF(Predicted < [33rd_percentile_value], 'Lower', IF(Predicted < [66th_percentile_value], 'Middle', 'Upper'))

4. Plot the Sliced Variance Navigate back to Analyses > Exploration > Descriptives. Move Residuals into the Variables box and Tercile into the Split by box. Expand Plots and select Box plot. You can now directly compare the vertical spread of the residuals across the three sections.

Method 3: Scale-Location Plot

Plot the square root of the absolute standardized residuals. This folds the plot in half and allows a standard trend line to reveal changes in variance.

Figure 4

jamovi: Scale-Location Plot

You can manually construct a Scale-Location plot using jamovi’s compute functions.

1. Save Model Outputs In Analyses > Regression > Linear Regression, under the Save menu, check Residuals and Predicted values.

2. Compute the Transformation Go to the Data tab. Select Compute to create a new variable named Scale_Location. Use the formula: SQRT(ABS(Residuals)). (Note: While traditional Scale-Location plots use standardized residuals, transforming raw residuals works identically for visually diagnosing variance trends).

3. Plot the Results Navigate to Analyses > Exploration > Scatterplot.

  • Place Predicted values on the X-axis and Scale_Location on the Y-axis.
  • Under Regression Line, select Smooth.

A flat, horizontal smoothed line indicates constant variance. A line with a distinct slope confirms heteroscedasticity.

Six Residual Plot Patterns (1/2)

✓ Random Scatter

(Good Pattern) Residuals scattered randomly above and below zero with no trend and roughly constant spread. This confirms linearity, constant variance, and independence.

✗ Funnel (Fan) Shape

(Problem Pattern) Residuals spread out as fitted values increase (or decrease). This signals heteroscedasticity. Consider log-transforming the response variable or using weighted least squares.

✗ Curved (U or Arch)

(Problem Pattern) A systematic curve means the true relationship is nonlinear but you fit a linear model. Add a quadratic term or transform the predictor. This is a model specification problem.

Six Residual Plot Patterns (2/2)

✗ Upward/Downward Trend

(Problem Pattern) Residuals systematically increase or decrease across fitted values. A relevant predictor is likely missing from the model. Adding it typically removes the trend.

✗ Isolated Outlier

(Investigate) One or a few points sit far from the rest. Large standardized residuals (beyond ±3) warrant investigation. May be an error or a genuinely unusual case.

✗ Clustering

(Problem Pattern) Residuals cluster into distinct groups rather than distributing evenly. This often indicates a categorical variable (group/time period) was omitted from the model.

Visual Reference Cheat Sheet

Figure 5