1. Home
  2. Explore
  3. Statistics
  4. Regression Diagnostics

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Regression Diagnostics

Speaker 1Speaker 2

Regression Diagnostics

14:16
0:00-14:16
  1. Michael

    Welcome to Lecture 9: regression assumptions and diagnostics. We’ll look at how to recognize errors that aren’t behaving as a regression model assumes, and what to do about them. Our main topics are heteroskedasticity, logged independent variables, interactions, autocorrelation, and multicollinearity.

  2. Maria

    Let’s start with what an error is. For an observation, the error is the actual value of the dependent variable minus the value our regression estimates for that observation. In a simple model, we might write the estimate as the slope times the independent variable, plus an intercept.

  3. Michael

    And if we average the errors across all observations, the average is zero. The model’s overestimates and underestimates cancel out mathematically. But that does not mean the model is trustworthy: errors can average to zero and still follow a systematic pattern.

  4. Maria

    That distinction matters. Ordinary least squares assumes that the model includes the relevant independent variables, and that any remaining errors are random. A one-off mistake on a survey—for example, someone accidentally reporting the wrong income—could create a random error for that respondent.

  5. Michael

    Real models are rarely perfect, though, and leaving relevant variables out can make errors predictable for some observations. One assumption we examine is homoskedasticity: the variance of the error term should be the same across values of the independent variables.

  6. Maria

    Picture savings as the dependent variable and income as the independent variable. At low, medium, and high income, the errors might each have a bell-shaped distribution centered around zero, with a similar spread. The errors can differ from person to person, but their variability is consistent across income levels.

  7. Michael

    When the variance changes across values of an independent variable, we call it heteroskedasticity. For instance, a model might predict savings closely for people with low incomes, while its predictions for people with high incomes are much less precise. The average error can still be zero even though the spread of errors changes.

  8. Maria

    Why is that a problem? The coefficient estimates may still be close to the true coefficients, but the estimates are less efficient and less precise. Larger errors can make significant results less likely and can reduce the model’s R-squared.

  9. Michael

    The lecture demonstrates a visual check in SPSS. First run the regression and calculate each observation’s estimated dependent-variable value. Then compute the error as actual dependent variable minus estimate, square that error, and graph the squared errors on the vertical axis against the independent variable on the horizontal axis.

  10. Maria

    In SPSS, the compute step uses Transform, Compute. You give the new variable a name, such as SqErrors, and enter the dependent variable minus the estimate, all in parentheses, followed by two asterisks and 2. The double asterisk tells SPSS to square the result, so use SPSS’s exact variable names and don’t put spaces in the expression.

  11. Michael

    Then use Graphs, Legacy Dialogs, Scatter/Dot, and Simple Scatter. Put SqErrors on the y-axis and the independent variable on the x-axis. Inspect the graph for a pattern in how large the squared errors are across the independent variable.

  12. Maria

    The example starts with education predicting income. The squared errors are larger at low levels of education and follow a cyclical pattern, so the errors don’t look randomly distributed across education. That gives us a reason to question the model’s specification.

  13. Michael

    One possible issue is an omitted independent variable. If age also influences income, a model using education alone leaves relevant information out. The lecture adds age to the regression, calculates the new estimates and squared errors, and plots those errors against education.

  14. Maria

    The new graph looks better: with one exception, squared errors are distributed fairly evenly between zero and 100 across education, and education is no longer correlated with the errors in the same way. Adding a relevant variable can improve predictions and reduce the pattern in the errors.

  15. Michael

    There’s another possible source of heteroskedasticity: the relationship may not be linear in the way we first modeled it. A linear model assumes the effect of an independent variable is the same across its values. In the lecture’s language, the coefficient stays constant.

  16. Maria

    But perhaps education has a positive, logged effect on income. Then a small increase in education would have a stronger effect at lower levels and a weaker effect at higher levels. A straight-line model could miss that shape and leave a visible pattern in its errors.

  17. Michael

    To model that possibility, transform the independent variable by taking its natural logarithm, then use the logged variable in the regression. In SPSS, choose Transform, Compute, name the new variable something like LogX, and enter LN followed by the independent variable in parentheses.

  18. Maria

    For the education example, that means computing LN of education, then running the regression with income as the dependent variable and LogX as the independent variable. The model’s coefficient now multiplies the logged independent variable, rather than education in its original form.

  19. Michael

    The lecture compares squared errors from the original model with errors from the model using logged education. Plot both sets against education itself. In the example, the original errors have a pattern, while the logged model’s errors no longer show that pattern.

  20. Maria

    The coefficient also needs a different interpretation. For a logged independent variable, a one-percent change in that variable corresponds to a change of the coefficient times 0.01 in the dependent variable. So if the coefficient is 3.019, a one-percent increase corresponds to 3.019 times 0.01, or 0.03019, in the dependent variable.

  21. Michael

    Now let’s turn to another way variables can interact: the effect of one independent variable may depend on the value of another. Suppose the effect of X1 on Y is positive when X2 is zero, but negative when X2 is one. Then X1’s effect depends on X2, which is an interactive effect.

  22. Maria

    To estimate it, include both original independent variables and their product. The model is the coefficient for X1 times X1, plus the coefficient for X2 times X2, plus a third coefficient times X1 multiplied by X2, plus the intercept. That product is the interactive term.

  23. Michael

    The coefficient for X1 describes X1’s effect when X2 equals zero: the X2 term and the product term drop out. If that coefficient is significant, X1 has a significant effect in that specific condition. If it isn’t significant, there’s no evidence of an effect in that condition.

  24. Maria

    The same logic applies to the coefficient for X2: it describes X2’s effect when X1 equals zero. So don’t report an interaction model as though each main-effect coefficient describes an effect that applies everywhere. Each one has a particular condition attached.

  25. Michael

    In SPSS, create the product first using Transform, Compute. Name the new variable, such as Interactive, and enter the first independent variable multiplied by the second. Then run the regression with both original variables and the interactive term included.

  26. Maria

    The lecture illustrates this with education, gender, and income. Gender is coded zero for men and one for women. The model’s education coefficient describes education’s effect when gender is zero—that is, for men—and that coefficient is not significant. So the output does not show evidence that education affects men’s income.

  27. Michael

    For women, we want education’s effect when gender equals one. Combining the education term with the education-by-gender interaction gives the women’s education effect. In the example, that effect is 330, but the original regression output does not directly provide its significance test.

  28. Maria

    The reason is that the standard error for a combination of coefficients differs from the standard error for either coefficient on its own. The ordinary significance tests in the output don’t test that combined effect. The lecture’s practical solution is to recode the other variable so the condition we care about becomes zero.

  29. Michael

    For women, the example creates a new gender variable that reverses the coding: zero now means women and one means men. It then creates a new interaction between that variable and education and runs the model again. The education coefficient is now 330 and is significant at the 0.001 level.

  30. Maria

    That supports a careful conclusion: there is no evidence in this example that education influences men’s income, while education has a positive, statistically significant association with women’s income. All else equal, an increase of one unit in education corresponds to an increase of 330 in income for women.

  31. Michael

    You can use the same recoding idea to ask whether gender’s effect changes with education. In the example, education is centered at nine by subtracting nine from each education value. The new education variable is zero when education is nine, making the gender coefficient describe the gender difference at that education level.

  32. Maria

    Then create a new interaction using the centered education variable and gender, and run the regression with both variables and that interaction. The reported conclusion is that there’s no evidence of a gender effect at low education levels, but at the higher level examined, women earn 2,520 more than men, with a significant result at the 0.001 level.

  33. Michael

    The key habit with interactions is to state the condition. Say which value of the other variable your coefficient describes, or recenter and recode so the condition of interest is represented directly. That keeps the interpretation tied to what the model actually estimates.

  34. Maria

    Next is autocorrelation, an assumption relevant to time-series models, where we observe subjects across multiple time periods. We assume errors are not correlated with time; in the lecture’s alternative framing, the dependent variable in one period should not be correlated with its value in a previous period.

  35. Michael

    When errors are related across time, we call it autocorrelation. Consider a model of Japan’s defense spending as a percentage of GDP, with U.S. troop deployments as an independent variable. Because the observations run over time, we need to check whether the errors show a time pattern.

  36. Maria

    In SPSS, first run the regression. Then compute the estimated values from the regression equation, without holding any variables constant. Compute errors as the dependent variable minus those estimates, and graph the errors on the y-axis against time on the x-axis.

  37. Michael

    In the Japan example, the errors follow a clear pattern: they are positive before 1960, negative from 1960 to 1980, and positive again after 1980. If errors were not patterned over time, they would be just as likely to be positive or negative throughout the graph.

  38. Maria

    One way to address autocorrelation is to add a time-count variable. It starts at zero in the first time period and increases by one in each subsequent period: year one is zero, year two is one, and so on. Then include it as an independent variable in the model.

  39. Michael

    In the lecture’s example, the errors look more random after adding the count variable. The model now accounts for a time trend in the dependent variable. Interpret the count variable like another independent variable: all else equal, each one-unit increase in time corresponds to the change in defense spending given by its coefficient.

  40. Maria

    The example reports a time-count coefficient of 0.0003. So, all else equal, as time increases by one unit, defense spending as a percentage of GDP increases by 0.0003. The time variable’s coefficient tells us how the dependent variable changes with each step in the count.

  41. Michael

    Another approach is to include a lagged dependent variable. That means using the dependent variable’s value in one period as an independent variable for the next period. Here, the question is whether Japan’s defense spending in one year helps predict its defense spending in the following year.

  42. Maria

    The lecture reports that the errors become more random after adding the lagged dependent variable. Its coefficient is interpreted like a regular independent-variable coefficient: all else equal, a one-unit increase in defense spending in the previous year corresponds to an increase of 0.940 in current defense spending.

  43. Michael

    Finally, multicollinearity occurs when independent variables are correlated with one another. The no-multicollinearity assumption says they should not be related. When predictors are highly similar, it can be like including the same independent variable twice.

  44. Maria

    That makes it harder for the model to distinguish which independent variable is influencing the dependent variable, so significant results are less likely. The lecture’s simple diagnostic is to run a correlation analysis between the independent variables and check whether any are highly correlated.

  45. Michael

    If you find a multicollinearity problem, one simple response is to leave one of the highly correlated variables out. Or you can run two separate models, including one of those variables in each model.

  46. Maria

    So the big diagnostic lesson is to look for patterns, not just averages. Errors can average to zero but still vary by income or education, move systematically over time, or reveal that a model needs a different functional form. And with interactions or highly correlated predictors, careful interpretation and model setup matter just as much as the output.

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent