Regression Diagnostics
Regression Assumptions and Diagnostics
Regression predictions and residuals
A regression model predicts a dependent variable from one or more independent variables. For a simple linear regression, the predicted value is
where Y^i is the prediction for observation i, a^ is the estimated intercept, and b^ is the estimated slope. The residual for an observation is the difference between its actual and predicted values:
A positive residual means the model underpredicted the observed value; a negative residual means it overpredicted it.
When an ordinary least squares (OLS) regression includes an intercept, its residuals sum to zero, so their average is zero. This does not mean that the model predicts every observation accurately. Overpredictions and underpredictions can cancel even when individual predictions are poor.
OLS also assumes that the model includes the relevant predictors and that unexplained variation is appropriately treated as random. In practice, omitted variables, incorrectly specified relationships, or time-related patterns can make residuals systematic rather than random. A zero average residual alone is therefore not enough to establish that a model is appropriate.
Homoskedasticity and heteroskedasticity
The homoskedasticity assumption
Homoskedasticity means that the variance of the error term is constant across the values of the independent variables. In practical terms, the model’s prediction errors should have a similar spread at low and high values of a predictor.
For example, if savings is predicted from income, the residuals should have roughly the same variability among people with low, middle, and high incomes. The residuals should be centered around zero at each income level, with no systematic widening, narrowing, or other pattern.
Heteroskedasticity and its consequences
Heteroskedasticity occurs when the variance of the errors differs across values of one or more independent variables. The model may predict well at some predictor values but poorly at others. For example, savings may be predicted precisely for people with low incomes, while predictions for people with high incomes have a much wider spread of errors.
Heteroskedasticity is a warning that the model’s unexplained variation is not distributed consistently. In the lecture’s framing, it can signal that the model is inefficient and its estimates less precise, reducing the likelihood of statistically significant results. More generally, under standard conditions heteroskedasticity does not necessarily bias OLS coefficient estimates, but it can make conventional standard errors, significance tests, and confidence intervals unreliable unless the issue is addressed.
Detecting heteroskedasticity with a graph
A basic diagnostic is to plot squared residuals against an independent variable:
Fit the regression and save or calculate its predicted values.
Calculate the residuals as actual outcome minus predicted outcome.
Square each residual.
Plot squared residuals on the vertical axis against an independent variable on the horizontal axis.
Inspect whether the points show a systematic pattern, such as increasing spread, clustering, or a cyclical shape.
In SPSS, predicted values and squared residuals can be calculated using Transform → Compute. A scatterplot can then be made using Graphs → Legacy Dialogs → Scatter/Dot → Simple Scatter. Variable names must match those used in the data file. A pattern in squared residuals suggests that the amount of prediction error varies with the predictor.
For example, a plot of squared income-prediction errors against education might show larger errors at low education levels and a cyclical pattern. Such a pattern indicates that the errors are not distributed randomly across education.
Addressing heteroskedasticity
A possible cause is an omitted predictor. If age affects income but is left out of a model that includes only education, the model may make systematically poor predictions for some education groups. Adding a theoretically relevant variable such as age may improve predictions and reduce patterned residual variation.
Adding predictors should be guided by theory and evidence, not done indiscriminately. A different cause is a misspecified functional form: the model may assume a straight-line relationship even though the relationship is curved. In that case, transforming a variable or otherwise modeling the nonlinear relationship may be more appropriate.
Linear effects and logged independent variables
What “linear in the parameters” means
A basic regression model assumes that a predictor has a constant slope: a one-unit increase in the predictor is associated with the same change in the predicted outcome throughout the predictor’s range. This is often described as being linear in the parameters: the coefficient is constant rather than changing with the value of the predictor.
The relationship between the variables does not have to be a straight line in their original units, however. A transformation such as taking the natural logarithm of a predictor can represent a curved relationship while keeping the regression linear in its coefficients.
Interpreting a positive logged effect
A positive logarithmic relationship has a stronger effect at lower values of the predictor and a weaker effect at higher values. A small increase in the predictor can produce a relatively large change in the outcome at low predictor values, but a smaller change at high values.
To model this shape, the predictor is transformed to its natural logarithm:
In SPSS, the logged variable can be created with Transform → Compute, using a new variable such as LogX and the expression LN(X). The regression is then run with the logged variable as the predictor.
Interpreting the coefficient
In a model where only the independent variable is logged, a 1% increase in the original predictor is associated approximately with a change of 0.01b^ units in the dependent variable, holding other predictors constant. This is an approximate interpretation, especially for larger percentage changes.
For example, if b^=3.019, then a 1% increase in education corresponds approximately to a change of
units in income, not 0.3019 or 0.0319. The outcome change is measured in the dependent variable’s units. This interpretation assumes the logged predictor is valid for the data; the natural logarithm is defined only for positive values.
A useful diagnostic is to compare residual patterns from the model using the untransformed predictor with those from the model using its logarithm. If the original model has a clear pattern in squared residuals but the logged model does not, the transformation may better represent the relationship.
Interactive effects
Meaning of an interaction
An interactive effect occurs when the effect of one independent variable on the dependent variable depends on the value of another independent variable. For example, education may have a different effect on income for different gender categories.
For two predictors, X1 and X2, an interaction model includes their product, X1X2:
The product term is the interaction term. In SPSS, it can be created with Transform → Compute by multiplying the two predictors, then included alongside both original predictors in the regression.
Interpreting the coefficients
The coefficient for X1 is the effect of X1 when X2=0. When X2=0, the terms involving X2 drop out:
Thus, b^1 does not describe the effect of X1 at every value of X2; it describes that effect specifically at X2=0. Likewise, b^2 is the effect of X2 when X1=0.
The effect of X1 at a particular value of X2 is
and the effect of X2 at a particular value of X1 is
A significant interaction coefficient indicates that the effect of one predictor changes as the other predictor changes. The main-effect coefficients should therefore be interpreted at the value zero of the other predictor, not as universal effects.
Example: education, gender, and income
Suppose gender is coded 0 for men and 1 for women, and the fitted equation is
For men, gender equals zero, so the education slope is 50. If that coefficient is not statistically significant, the model does not provide evidence of an education–income association for men.
For women, gender equals one. The education slope is 50+280=330, and the intercept is 100−730=−630. The fitted equation for women is therefore
The education slope for women is not obtained by looking at the significance of the education coefficient alone in the original model. The original coefficient tests the education effect when gender is zero—that is, for men under this coding. Whether the combined slope for women is statistically significant requires a test of the sum of the education and interaction coefficients.
Testing conditional effects by recentering
A coefficient for a combined effect, such as b^1+b^3, has a standard error that depends on the variances and covariance of the two estimated coefficients. It is not generally valid to infer the significance of the combined effect by looking at the separate significance tests for the original coefficients.
A practical approach is to recenter or recode a predictor so the value of interest becomes zero. Then the coefficient for the other predictor directly represents its effect at that value, and the regression output gives a significance test for that coefficient.
For example, if gender is coded 0 for men and 1 for women, a new gender variable can be created that is 0 for women and 1 for men. In a model using this recoded variable and its interaction with education, the education coefficient represents the education effect for women. In the example, that coefficient is 330 and is statistically significant at the 0.001 level. The conclusion is that the model provides evidence of an education–income association for women, but not for men.
Recentering can also test a conditional effect of gender at a particular education level. If education’s high value is 9, define a new variable:
This variable equals zero when education equals nine. Recreate the interaction using Education9 and gender, then fit the model again. The gender coefficient now represents the gender difference when education is nine. In the example, that difference is positive and statistically significant at the 0.001 level, with women earning 2,520 more than men at that education level, all else equal.
When reporting an interaction, it is essential to state the value or group at which an effect applies. “Education affects income” is incomplete if the estimated effect differs by gender; a clearer statement specifies the gender category and the statistical evidence for that conditional effect.
Autocorrelation
The assumption and its violation
For time-series regression, observations are ordered over time. The regression assumption is that errors are not correlated across time. Autocorrelation occurs when errors are related to errors in other time periods, creating a systematic temporal pattern rather than random variation.
A related substantive question is whether the dependent variable in one period helps predict its value in a later period. For instance, a country’s defense spending in one year may be related to its defense spending in the next year. A lagged dependent variable can represent this persistence in a model.
Detecting autocorrelation with a graph
A basic diagnostic is to plot the regression residuals against time:
Fit the regression model.
Calculate its predicted values using the fitted equation.
Calculate residuals as observed outcome minus predicted outcome.
Plot residuals on the vertical axis against time on the horizontal axis.
Look for stretches of positive or negative residuals, cycles, or other patterns.
A random-looking plot should not show long periods in which residuals are mostly positive or mostly negative. For example, if residuals are positive before 1960, negative from 1960 to 1980, and positive again after 1980, the error pattern is associated with time.
In SPSS, the predicted values and residuals can be calculated using Transform → Compute; the residuals can then be plotted against a time variable using a scatterplot. The prediction equation should include the model’s predictors as specified, without unintentionally holding variables constant.
Including a time count variable
One way to model a systematic time trend is to include a time count variable. It begins at zero in the first period and increases by one in each subsequent period. A model predicting Japan’s defense spending as a percentage of GDP, for example, could include both U.S. troop deployments and the time count.
If the time coefficient is 0.0003, its interpretation is: holding the other predictor constant, a one-unit increase in time is associated with a 0.0003-unit increase in defense spending as a percentage of GDP. The time unit must be stated—for example, one year if each observation is annual.
After adding the count variable, residuals can again be plotted against time. A reduction in the temporal pattern suggests that the model has accounted for some variation associated with the trend.
Including a lagged dependent variable
Another approach is to use a lagged dependent variable: the outcome from one period is included as a predictor for the outcome in the next period. This tests whether the previous period’s outcome is associated with the current period’s outcome.
For example, a model of Japan’s defense spending can include the previous year’s defense spending. If the estimated coefficient is 0.940, then, holding other predictors constant, a one-unit increase in defense spending in the previous year is associated with a 0.940-unit increase in defense spending in the current year.
Residuals should be rechecked after including a lagged outcome. A less patterned residual plot suggests improvement, but it does not by itself prove that every time-series issue has been resolved.
Multicollinearity
Meaning and consequences
Multicollinearity occurs when two or more independent variables in a model are strongly related to one another. In the extreme case, one predictor can be perfectly predicted from another. When predictors contain much of the same information, it can be difficult to distinguish their separate relationships with the dependent variable.
Multicollinearity often increases uncertainty around individual coefficient estimates. As a result, a model may have difficulty identifying which of two similar predictors has a distinct association with the outcome, and individual coefficients may be less likely to appear statistically significant. This does not necessarily mean the predictors have no relationship with the outcome; rather, the model may have limited information for separating their individual effects.
Detecting and addressing multicollinearity
A simple initial check is to calculate correlations among the independent variables. A high correlation suggests a possible multicollinearity problem, though pairwise correlations may not detect every form of multicollinearity involving several predictors together.
Possible responses include:
Remove one of two highly related predictors if theory and the research question support doing so.
Fit separate models, including one of the related predictors in each model, and compare the results.
The appropriate response depends on the purpose of the analysis. Predictors should not be removed automatically: if both represent important concepts, the researcher should consider whether each can be estimated reliably and explain the limitations of separating their effects.
Key diagnostic principles
Residuals averaging zero does not establish that a regression model is well specified.
Heteroskedasticity is variation in error spread across predictor values; inspect residual or squared-residual patterns and consider omitted variables or nonlinear relationships.
Logged predictors model a diminishing relationship and require a percentage-based interpretation of their coefficients.
Interactions represent conditional effects; interpret each main effect at zero of the other interacting predictor and test effects at other values appropriately.
Autocorrelation is temporal structure in regression errors; plot residuals against time and consider a time trend or lagged outcome when substantively justified.
Multicollinearity makes it harder to distinguish the separate effects of correlated predictors; inspect correlations and choose model adjustments based on theory.

Ask anything
We've read this whole study set, so questions about it get the best answers.