Regression - Diagnostic - Test Residual Serial Correlation (Durbin-Watson) extension

From Q
Jump to navigation Jump to search


Performs a Durbin-Watson test of serial correlation (auto-correlation) on the residuals of a model.

Example

The following table shows the output from running this diagnostic on an output from Regression - Ordered Logitordered logit.

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 Regression - Binary Logit, Regression - Ordered Logit, and Regression - Multinomial Logitbinary logit, ordered logit, and multinomial logit, 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

  1. Serial correlation violates the statistical testing assumptions of regression models. This may mean that results are shown as being significant that should not be shown as significant.
  2. 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 adjust 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]. Accessed from https://www.displayr.com/autocorrelation/.

Code

includeWeb("QScript R Output Functions");

const menu_location = "Regression > Diagnostic > " +
      "Test Residual Serial Correlation (Durbin-Watson)";
errorIfExtensionsUnavailableInQVersion(menu_location);
createDiagnosticROutputFromSelection(menu_location);