One of the main assumptions in linear regression is that there is no correlation between consecutive residuals. In other words, it’s assumed that the residuals are independent.
When this assumption is violated, the standard errors of the coefficients in a regression model are likely to be underestimated which means predictor variables are more likely to be deemed statistically significant when they’re actually not.
One way to determine if this assumption is met is to perform a Durbin-Watson test, which is used to detect the presence of autocorrelation in the residuals of a regression.
Steps to Perform a Durbin-Watson Test
The Durbin-Watson test uses the following hypotheses:
H0 (null hypothesis): There is no correlation among the residuals.
HA (alternative hypothesis): The residuals are autocorrelated.
The test statistic for the Durbin-Watson test, typically denoted d, is calculated as follows:
where:
- T: The total number of observations
- et: The tth residual from the regression model
The test statistic always ranges from 0 to 4 where:
- d = 2 indicates no autocorrelation
- d
- d > 2 indicates negative serial correlation
In general, if d is less than 1.5 or greater than 2.5 then there is potentially a serious autocorrelation problem. Otherwise, if d is between 1.5 and 2.5 then autocorrelation is likely not a cause for concern.
To determine if a Durbin-Watson test statistic is significantly significant at a certain alpha level, you can refer to this table of critical values.
If the absolute value of the Durbin-Watson test statistic is greater than the value found in the table, then you can reject the null hypothesis of the test and conclude that autocorrelation is present.
What to Do if Autocorrelation is Detected
If you reject the null hypothesis of the Durbin-Watson test and conclude that autocorrelation is present in the residuals, then you have a few different options to correct this problem if you deem it to be serious enough:
- For positive serial correlation, consider adding lags of the dependent and/or independent variable to the model.
- For negative serial correlation, check to make sure that none of your variables are overdifferenced.
- For seasonal correlation, consider adding seasonal dummy variables to the model.
These strategies are typically sufficient to remove the problem of autocorrelation.
Examples of Performing a Durbin-Watson Test
For step-by-step examples of Durbin-Watson tests, refer to these tutorials that explain how to perform the test using different statistical software:
How to Perform a Durbin-Watson Test in R
How to Perform a Durbin-Watson Test in Python
How to Perform a Durbin-Watson Test in Excel