# How to tell if residuals are autocorrelated from a graphic

When you do an OLS regression and plot the resulting residuals, how can you tell if the residuals are autocorrelated? I know there are tests for this (Durbin, Breusch-Godfrey) but I was wondering if you can just look at a plot to gauge if autocorrelation could be a problem (because for heteroskedasticity it is fairly easy to do so).

## migrated from math.stackexchange.comFeb 17 '13 at 0:39

This question came from our site for people studying math at any level and professionals in related fields.

Not only can you look at a plot, I think it's generally a better option. Hypothesis testing in this situation answers the wrong question.

The usual plot to look at would be an autocorrelation function (ACF) of residuals.

The autocorrelation function is the correlation of the residuals (as a time series) with its own lags.

Here, for example, is the ACF of residuals from a small example from Montgomery et al

Some of the sample correlations (for example at lags 1,2 and 8) are not particularly small (and so may substantively affect things), but they also can't be told from the effect of noise (the sample is very small).

Edit: Here's a plot to illustrate the difference between an uncorrelated and a highly correlated series (in fact, a nonstationary one)

The upper plot is white noise (independent). The lower one is a random walk (whose differences are the original series) - it has very strong autocorrelation.

• Thanks for the answer. When you look at the plots on wiki(en.wikipedia.org/wiki/File:Acf_new.svg), can you tell from the upper plot (not the ACF plot) that the residuals are autoccorelated? – John Doe Feb 17 '13 at 10:31
• I'd be saying "hmm, looks vaguely cyclical... might be autocorrelation, might not. What's the ACF look like?" – Glen_b Feb 17 '13 at 11:18
• Okay, but could you elaborate on that: For example, I found this question: stats.stackexchange.com/questions/14914/… Apparently, there is autocorrelation. What specifically am I looking for to come to this conclusion? – John Doe Feb 17 '13 at 12:28
• Sure, that one shows something that will produce positive autocorrelation (though I'd probably put it down to trend as well as dependence about the trend). Consider - if observations are independent, then think about the chance that a long run of them will be on one side of the mean or the other, with none on the opposite side. I think the best first option is to simulate data that is autocorrelated at various levels and look at it. – Glen_b Feb 17 '13 at 12:48
• I get that you have no autocorrelation when the data is just randomly distributed. But as an indicator for autocorrelation, is it enough when the data is not randomly distributed or do you a kind of pattern (e.g. a data point with a high value is followed by multiple data points with a high value)? – John Doe Feb 17 '13 at 22:59

It's not unusual if 5% or less of the autocorrelation values fall outside the intervals as that could be due to sampling variation. One practice is to produce autocorrelation plot for first 20 values and check whether more than one value falls outside the allowed intervals.