## Requirements

- A regression model output.

Please note these steps require a **Displayr **license.

## Method

- Select the regression output.
- Go to the
**object inspector > Data > Diagnostics >Test Residual Serial Correlation (Durbin-Watson)**.

### Technical Details

This test checks an aspect of the assumption of regression that residuals are independent. It works by testing to see if there is any positive or negative correlation between residuals, based on their order in the data. It tests for first-order serial correlation (i.e., that a residual is correlated with the adjacent residuals). A permutation test is performed, which makes the test applicable to any model that has residuals (i.e., the implementation does *not* assume that the residuals are normal with a constant variance).

For , the residuals used in the test are the difference between the observed category number (1, 2, ...) and the category with the highest probability of being predicted.

### Consequences of serial correlation

- Serial correlation violates the statistical testing assumptions of regression models. This may mean that results are shown as being significant but should not be shown as significant.
- Serial correlation can arise when the model's assumptions about causality are incorrect. For example, when:
- Linear effects are used in models and non-linear models are more appropriate.
- Data is clustered, but this clustering has been ignored in the model.
- There are lagged feedback mechanisms in time series models. E.g., sales today may be a function of advertising last month.

### Remedies for serial correlation

There is no straightforward remedy for serial correlation. Where it exists, the only safe approach is to identify what has caused it, and then specify a model that takes this into account. When estimating time series models, *Newey West* standard errors can be computed, which adjusts for serial correlation.

## References

Durbin, J., & Watson, G. S. (1950). Testing for serial correlation in least squares regression: I. Biometrika, 37(3/4), 409-428.

Bock, T. (2018, April 9). What is autocorrelation? [Blog post].

## Next

How to Run Binary Logit Regression

How to Run a Generalized Linear Model

How to Run a Multinomial Logit Regression

How to Run NBD Regression in Displayr

How to Run Ordered Logit Regression

How to Run Quasi-Poisson Regression

How to Run a Stepwise Regression

How to Test Residual Heteroscedasticity of Regression Models

How to Test Residual Normality (Shapiro-Wilk) of Regression Models