How to understand the homoscedasticity and heteroscedasticity in context of regression models?
Is there a way to check these properties in R?

  • 1
    $\begingroup$ One place to start is here. Adding more search terms may help narrow the results. $\endgroup$
    – Glen_b
    Apr 11, 2014 at 15:35
  • $\begingroup$ @Glen_b Including the terms "Breusch" and "Pagan" identifies several good answers. $\endgroup$
    – whuber
    Apr 11, 2014 at 15:39
  • $\begingroup$ @whuber That would be a way to conduct a formal hypothesis test for one particular form of heteroskedasticity... but that formal test is not necessarily a good way to (a) understand heteroskedasticity, nor (b) do checking of regression heteroskedasticity assumptions in general - which as I read it are the two parts of this question. I think if one is in the part of model formulation where basic assumptions are a concern, probably some visual diagnostics would be the place to start. I had planned to come back and add an answer to that effect here, but now I can't. $\endgroup$
    – Glen_b
    Apr 11, 2014 at 23:26
  • $\begingroup$ @whuber In fact I don't think that post is a suitable duplicate. There might be some near duplicates, but to my mind, that isn't one. $\endgroup$
    – Glen_b
    Apr 11, 2014 at 23:29
  • 1
    $\begingroup$ @Glen_b Thank you for pointing out the differences: I therefore voted to re-open this question. $\endgroup$
    – whuber
    Apr 13, 2014 at 15:15

1 Answer 1


In R when you fit a regression or glm (though GLMs are themselves typically heteroskedastic), you can check the model's variance assumption by plotting the model fit.

That is, when you fit the model you normally put it into a variable from which you can then call summary on it to get the usual regression table for the coefficients. If you plot the same variable you get some diagnostic plots.

For example, consider:

carmdl <- lm(dist~speed,cars)

The third of the default plots that it produces is the scale-location plot:

plot of sqrt of absolute standardized residuals vs fitted, a.k.a. scale-location plot, to identify heteroskedasticity. In this case it shows fairly constant spread, perhaps higher on the right than on the left, indicating slightly higher residual spread at the larger fitted values

[Other common choices for the y-axis in such a plot are the absolute residual and the log of the squared residual.]

That's a basic visual diagnostic of the spread of standardized (for model-variance) residuals against fitted values, which is suitable for seeing if there's variability related to the mean (not already accounted for by the model). If the assumption of homoskedasticity is true, we should see roughly constant spread. In this case the indication of increase with fitted values is fairly mild.

A common form of heteroskedasticity to look for would be where there's an increase in spread against fitted values. That would show as an increasing trend in the plot above. It can also be formally tested by the Breusch-Pagan test (though formal hypothesis tests of model assumptions aren't necessarily the best choice).

There are other forms of heteroskedasticity that are possible, but that's the most common one to check for. For example, if changing spread against a particular predictor was expected, that would suggest plotting the residual spread measure above against that predictor.


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.