How to test for independence of residuals in linear model?

How to test for independence of residuals in linear model?

What can I plot? What can I look for in the plots?
Or are there some other statistics that I can compute?

• Here is a related post. – lmo Nov 25 '16 at 21:00

[I thought I'd be able to find a close duplicate with a similar answer but a couple of searches didn't turn up something suitable for some reason. I'll post an answer for now but I may still locate a duplicate.]

1. Note that residuals are not actually independent. It's the error term that's assumed to be independent. The residuals estimate the error term but they're definitely dependent.

2. There are many, many ways for errors to fail to be independent, so it's quite hard to do a general test for dependence (there are a few very general dependence tests but they require very large sample sizes to pick much up; failing to find dependence with a test that has its power scattered to the four winds is not much consolation). For more typical problems, you really need to specify what kind of dependence you might be looking for. For example, if you have observations over time, you might anticipate autocorrelation, which is easy to look for via an acf plot. If you suspect some form of intra-class correlation where there's a "class" variable not in the model (or indeed any dependence due to a variable not being in the model) but you have the variable or a reasonable proxy, it's easy enough to see whether residuals relate to that variable. So if you can elucidate a likely source of dependence in your problem, that will tell you a great deal about what kinds of things to look for.

When you want to check for dependence of residuals, you need something they can depend on. There are basically 2 classes of dependencies

1. Residuals correlate with another variable
2. Residuals correlate with other (close) residuals (autocorrelation)

For 1), it is common to plot

• Res against predicted value
• Res against predictors

You can formalize any dependency you spot with a correlation test or a regression if you want, but usually problems are visually identified.

For 2), one can use autocorrelation plots or spatial / temporal variograms. A formal analysis can be done with the usual time-series / spatial analysis methods, e.g. Durbin-Watson or a CAR model for temporal, or MORAN's I for spatial. Note the caveats of all these methods, e.g. that they usually assume homogeneity of the correlation structure, which is commonly violated.

When the error terms in the model are independent the dependence of the residuals is mild. So testing that the residuals are independent or uncorrelated under the normal assumption is what is commonly done.

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

• I really fail to see why this makes any sense... Assume normality? Outside of textbooks or simulation, I cannot think of a situation where this would be appropriate – Repmat Nov 29 '16 at 13:08
• @Repmat If one does F-testing, normality would be best. – Carl Jun 15 '18 at 2:55