This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Durbin-Watson Test


The Durbin-Watson test assesses whether there is autocorrelation among the residuals or not.


The Durbin-Watson test statistic, DW, is


where ri is the ith raw residual, and n is the number of observations.

How To

After obtaining a fitted model, say, mdl, using fitlm or stepwiselm, you can perform the Durbin-Watson test using

For details, see the dwtest method of the LinearModel class.

Test for Autocorrelation Among Residuals

This example shows how to test for autocorrelation among the residuals of a linear regression model.

Load the sample data and fit a linear regression model.

load hald
mdl = fitlm(ingredients,heat);

Perform a two-sided Durbin-Watson test to determine if there is any autocorrelation among the residuals of the linear model, mdl.

[p,DW] = dwtest(mdl,'exact','both')
p = 0.8421
DW = 2.0526

The value of the Durbin-Watson test statistic is 2.0526. The p-value of 0.8421 suggests that the residuals are not autocorrelated.

See Also

| | | |

Related Topics