The Durbin-Watson test is designed to check for autocorrelation in standard least squares models (for example, one installed lm). If autocorrelation is detected, it can then be explicitly fixed in the model, using, for example, generalized least squares ( glsin R). I understand that Durbin-Watson is not suitable for testing “goodness of fit” in the resulting models, since glsresiduals may no longer follow the same distribution as residuals of the standard model lm. (Someone with a deeper knowledge of statistics should correct me if I am wrong).
durbinWatsonTest car . - :
v <- gls( ... )$residuals
attr(v,"std") <- NULL
car::durbinWatsonTest( v )
, durbinWatsonTest p lm (, - ), , /.