# [R] Durbin-Watson

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Wed Aug 5 13:12:18 CEST 2009

```On Wed, 5 Aug 2009, Hardi wrote:

> Hi,
>
> I ran an experiment with 3 factors, 2 levels and 200 replications and as
> I want to test for residuals independence, I used Durbin-Watson in R.
> I found two functions (durbin.watson and dwtest) and while both are
> giving the same rho, the p-values are greatly differ:
>
>> durbin.watson(mod1)
> lag Autocorrelation D-W Statistic p-value
>   1     -0.04431012      2.088610   0.012
> Alternative hypothesis: rho != 0
>
>> dwtest(mod1)
>        Durbin-Watson test
> data:  mod1
> DW = 2.0886, p-value = 0.9964
> alternative hypothesis: true autocorrelation is greater than 0
>
> durbin.watson suggests that I should reject the null hypothesis while
> dwtest suggests that I should NOT reject Ho.

What do you expect? The default alternative in durbin.watson() is rho != 0
(as displayed above!) and in dwtest() it is rho > 0 (as displayed above!).
For an empirical correlation of -0.044 one would hope that the p-values
are very different.

Beyond that, the approaches for computing the p-value in durbin.watson()
and dwtest() are different. The former uses resampling techniques, the
latter uses either the exact or approximate asymptotic distribution.

> If I look it up in the following table:
> http://www.stanford.edu/~clint/bench/dw05d.htm, T = 1600 and K = 8 gives
> dL = 1.90902 and dU = 1.92659.
> Which means I should not reject Ho as DW > dU.

First, this is inferior technology compared to both approaches discussed
above. Second, you are using it wrong! These are upper and lower bounds
for a single critical value for the one-sided alternative rho > 0. So
interpreting it correctly DW > dU means that you can confidently conclude
that DW is _not_ significant. But you didn't need a significance test for
that when the empirical correlation is less than zero and you want to show
that it is greater than zero.

> Is there a bug in durbin.watson? should I use dwtest instead? can
> somebody help me explain what is happening?

It might help if you read about the theory behind the Durbin-Watson test
and why it is difficult to evaluate its null distributions.

Best,
Z

```