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:

**H _{0} (null hypothesis): **There is no correlation among the residuals.

**H _{A} (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**e**The t_{t}:^{th}residual from the regression model

The test statistic always ranges from 0 to 4 where:

*d*= 2 indicates no autocorrelation*d*< 2 indicates positive serial correlation*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**

The following tutorials explain how to perform the Durbin-Watson 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

I have a question. Why Durbin and Watson invented such a test? Why not use T test directly in a regression between e(t) and e(t-1) ? e(t) is the residuas in time t.

You give three things to consider if the test rejects the null hypothesis, and several possible remedies, but you don’t discuss any of the remedies or give any examples, or, possibly, a URL pointing to such topics.

Those would be helpful to someone like me who is just starting out.