# [R] Durbin-Watson test in packages "car" and "lmtest"

Torsten Hothorn Torsten.Hothorn at rzmail.uni-erlangen.de
Fri Apr 19 10:49:58 CEST 2002

```> Hi,
> P-values in Durbin-Watson test obtained through the use of
> functions available in packages "lmtest" and "car" are different. The
> difference is quite significant. function "dwtest" in "lmtest" is much
> faster than "burbinwatson" in "car". Actually, you can take a nap while
> the latter trying to calculated Durbin-Watson test. My question is which
> p-value is better?

The answer is essencially given in ?durbin.watson and ?dwtest. The latter
states that

The p value is computed
using a Fortran version of the Applied Statistics Algorithm AS 153
by Farebrother (1980, 1984). This algorithm is called "pan" or
"gradsol". For large sample sizes the algorithm might fail to
compute the p value; in that case a warning is printed and an
approximate p value will be given; this p value is computed using
a normal approximation with mean and variance of the Durbin-Watson
test statistic.

while ?durbin.watson says

simulate: if `TRUE' p-values will be estimated by bootstrapping.

What is a "quite significant" difference for p-values?

Looking at the example from ?durbin.watson gives:

R> durbin.watson(lm(fconvict ~ tfr + partic + degrees + mconvict,
data=Hartnagel))
lag Autocorrelation D-W Statistic p-value
1        0.688345     0.6168636       0
R> dwtest(fconvict ~ tfr + partic + degrees + mconvict, data=Hartnagel)

Durbin-Watson test

data:  fconvict ~ tfr + partic + degrees + mconvict
DW = 0.6169, p-value = 6.96e-09

which is fairly close, so you might give us more details (that is: a
working example) to see what the "difference" is (that is: a bug in
either function or a difference due to simulation error / bad
approximation ...).

Torsten

>
> Thank you,