# Evidence for heteroscedasticity from unordered values

I'm fitting a linear regression model on a dataset about how many upvotes a certain post will get based on its views, its author's reputation ecc. To satisfy the normality assumptions I performed a boxCox transformation and subsequently log-transformed the response: I obtained a p-value of $$0.3$$ in a Shapiro test and a fairly good looking qq-plot.

However when checking for residuals homoscedasticity I get the following plots:

On the left I plotted the residuals vs the model fitted values, while on the right the residuals (vs their indices) in a casual order.

From the right plot nothing looks wrong, however the left one (along with an R's ncvTest, p-value $$1.31e-07$$) may suggest heteroscedasticity at first glance, although the fact that all the data points are clustered on the left is consequence of the distribution of the upvotes response variable (hence of the fitted values). Plus I can't really spot any variance trend. I'm also reporting the plots of the residuals following the order of the predicted values:

From here a slightly more disuniform trend arises, but is it sufficient to conclude that the model is affected by heteroscedasticity?

Plus any weighted regression I've tried seems uneffective.

Thanks in advance!

## 1 Answer

Remember that homoscedasticity refers to the homogeneity of the variance of residuals over the range of fitted values, not to their trend. From your plots, especially the bottom left one, it appears that there is a positive trend (residuals do not remain centered on 0, they increase with fitted values) but the variance remains the same. Thus you do have an issue of non-linearity, but not of heteroscedasticity. Non-linearity might be due to missing an important predictor, or a non-linear relationship with one (or some) of the predictor(s).

Last comment: if you plot residual plots in an arbitrary, meaningless order (as is presumably the case of your plots on the right) you may lose the useful information to interpret it.

• I agree with the first paragraph. The last paragraph looks wrong. Homoscedasticity means that variances are constant, and this means constant over whatever ordering you are interested in, as long as the ordering is not determined by the values of y or the residuals. You can plot against observation order (as long as this is meaningful, usually a time order), or against any x-variable, and the variance should still be constant under homoscedasticity. – Lewian Jun 26 at 15:10
• You're right, I should have been more specific. My comment was prompted by the OP's plots on the right, where the residuals were plotted against their (presumably meaningless) indices. I edited my answer. Thanks for pointing it out. – Ous Jun 27 at 13:35