I am checking that I have met the assumptions for multiple regression using the built in diagnostics within R. I think that from my online research, the DV violates the assumption of homoscedasticity (please see the residuals vs fitted plot below). enter image description here

I tried log transforming the DV (log10) but this didn't seem to improve the residuals vs fitted plot. There are 2 dummy coded variables within my model and 1 continuous variable. The model only explains 23% of the variance in selection (DV) therefore, could the lack of homoscedasticity be because variable/s are missing? Any advice on where to go from here would be greatly appreciated.

  • 1
    $\begingroup$ Seen better, seen much worse. Judging these plots is a dark and subjective art. I am a fan of residual diagnostics but, consistently with that, I believe, I stress that getting the functional form right is more important than matching error assumptions exactly, which you will never manage. The main messages I pick up from the plot are that the overall shape looks about right, but I see two big clumps and one smaller one, so does that match anything we should worry about? I like to look at observed vs fitted, which is sometimes as or more informative. $\endgroup$ – Nick Cox Nov 18 '15 at 1:51
  • $\begingroup$ There is always scope in principle for using other predictors to improve a disappointing model. $\endgroup$ – Nick Cox Nov 18 '15 at 1:53
  • $\begingroup$ Thanks Nick. How do I generate the observed vs fitted plot? This doesn't seem to be in the default R diagnostics plots. $\endgroup$ – Courtney Nov 18 '15 at 2:02
  • 2
    $\begingroup$ I see only very weak indication of heteroskedasticity. With a similar pattern of X's and simulated homoskedastic data of the same sample size you'd probably see a worse picture than that fairly often (if you have the data you can actually try such an exercise). The plot Nick is talking about would be fm=lm(y~x);plot(y~fitted(fm)), but you can usually figure out what it will look like from the residual plot -- if the raw residuals are $r$ and the fitted values are $\hat{y}$ then $y$ vs $\hat{y}$ is $r + \hat{y}$ vs $\hat{y}$; so in effect you just skew the raw residual plot up 45 degrees. $\endgroup$ – Glen_b Nov 18 '15 at 4:29
  • 1
    $\begingroup$ This pattern is more obvious on an observed vs fitted plot on which zero observed is explicit as the $x$ axis. I like that plot because it underlines how the model is doing near zero observed. I suspect slight curvature in your data not quite captured by the plain (plane?) linear model and that logarithms would help. As said, getting the functional form right trumps well-behaved diagnostic plots. If we posted the data, we could play. $\endgroup$ – Nick Cox Nov 18 '15 at 9:31

It's difficult to judge the structure of the error terms just by looking at residuals. Here's a plot similar to yours, but generated from simulated data where we know the errors are homoskedastic. Does it look "bad"?



n <- 300
df <- data.frame(epsilon=sqrt(40) * rt(n, df=5))
df$x <- rnormmix(n, lambda=c(0.02, 0.30, 0.03, 0.60, 0.05),
                 mu=c(8, 16, 30, 36, 52), sigma=c(2, 3, 2, 3, 6))
df$y <- 2 + df$x + df$epsilon
model <- lm(y ~ x, data=df)
plot(df$y ~ fitted(model))
plot(residuals(model) ~ fitted(model))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.