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

About this list Date view Thread view Subject view Author view Attachment view

From: Ahmad Abu Hammour (hammour@msn.com)
Date: Sat 20 Apr 2002 - 07:05:34 EST


Message-id: <OE82j0aImPiZxOASWTg0001df30@hotmail.com>

Hi Torsten,
Here is an example in which P-values have a significant difference. The data is a sub sample of a larger one.
Basically the model I am using is as follows:
y_{t+2}= y_{t+1} + y_t + I(x_{t+1}-z_{t+1}-w_{t+1}) +e_{t+2}
  
> ydata
                  y z w x
 [1,] 0.0101705342 -5.363636567 0.80677087 -2.425968
 [2,] -0.0040963887 -4.930336567 -0.01515276 -1.852668
 [3,] 0.0007996203 -2.795136567 0.28412361 -0.849268
 [4,] 0.0231375722 -2.523036567 -0.33650002 -0.315968
 [5,] 0.0576658597 -2.925936567 -0.68112365 0.060732
 [6,] 0.0930807057 -2.283836567 -1.59374728 0.214032
 [7,] 0.0904861271 -1.908436567 -3.15057091 0.347332
 [8,] 0.0815802452 -3.063936567 -3.60669454 -0.175968
 [9,] 0.0463679856 -3.947236567 -2.89361816 -1.012668
[10,] 0.0283314000 -3.528136567 -1.68974179 -1.522668
[11,] 0.0158693958 -2.890536567 -1.03456542 -1.629268
[12,] -0.0177988767 -2.165736567 -0.23008905 -1.532668
[13,] -0.0263232785 -2.400436567 -0.29991268 -1.369268
[14,] -0.0377695478 -3.243136567 -0.31953631 -0.539268
[15,] -0.0520095622 -3.241336567 0.22174006 0.120732
[16,] -0.0773138815 -2.765236567 -0.22328356 1.467332
[17,] -0.0804307590 -2.833236567 0.09209281 2.107332
[18,] -0.0446189151 -3.710136567 0.57246918 2.057332
[19,] -0.0439761920 -4.232636567 0.11764555 2.687332
[20,] -0.0508314286 -3.445136567 0.91252192 4.874032
[21,] -0.0373526376 -2.123836567 1.03269829 5.340732
[22,] -0.0363366045 -4.549336567 1.16137466 3.614032
[23,] -0.0119795294 -4.660636567 2.10495103 1.744032
[24,] -0.0271166745 0.940863433 2.73172741 5.450732
[25,] -0.0319279899 2.972463433 3.93230378 7.954032
[26,] -0.0285519284 2.601663433 4.25698015 9.447332
[27,] -0.0362890374 3.900363433 4.49975652 11.397332
[28,] -0.0193261619 2.440563433 4.24003289 7.057332
[29,] -0.0211604332 4.133063433 3.62460926 5.907332
[30,] -0.0393599621 4.764863433 3.78798563 6.740732
[31,] -0.0368496844 2.967363433 3.09016201 5.137332
[32,] -0.0111656400 2.374163433 2.32173838 1.820732
[33,] -0.0049543837 2.858663433 0.59471475 0.570732
[34,] -0.0085112660 3.900063433 -0.96020888 0.424032
[35,] 0.0002988086 3.956163433 -1.40353251 0.500732
[36,] -0.0021387277 2.276463433 -1.99135614 0.720732
[37,] -0.0143497002 2.857863433 -1.40157977 1.270732
[38,] -0.0459512047 3.589163433 -1.78060340 2.574032
[39,] -0.0620556482 4.248163433 -2.43422702 3.537332
[40,] -0.0665723041 3.225363433 -2.45305065 1.830732
[41,] -0.0990262190 2.638163433 -2.34577428 1.634032
[42,] -0.0993943457 2.160963433 -2.00509791 0.780732
[43,] -0.0896954664 1.651763433 -1.79992154 0.164032
[44,] -0.1047509912 2.106963433 -1.59274517 0.117332
[45,] -0.1188326548 3.230463433 -1.40576880 2.007332
[46,] -0.1012159404 2.484063433 -1.60469242 -0.209268
[47,] -0.0975617833 2.185163433 -1.23841605 -0.442668
[48,] -0.0859923186 1.244563433 -0.99983968 -0.495968
[49,] -0.0467949427 -0.185636567 -1.19776331 -1.649268
[50,] -0.0351160760 -0.510836567 -0.50778694 -0.569268
[51,] -0.0233943108 -0.356136567 -0.53781057 0.347332
[52,] -0.0080094290 0.005063433 -0.71733420 -0.569268
[53,] 0.0312603960 -0.149336567 -0.69205783 -0.349268
[54,] 0.0614944090 0.181063433 -0.76188145 0.237332
[55,] 0.0775709808 0.795863433 -0.58080508 1.110732
[56,] 0.0952235601 1.131763433 -0.38712871 1.907332
[57,] 0.1069545973 1.509763433 0.06534766 2.887332
[58,] 0.1136253179 1.785763433 0.64482403 3.450732
[59,] 0.1275201332 1.348463433 1.06650040 3.410732
[60,] 0.1387864450 0.581263433 1.05767677 3.444032
[61,] 0.1244438565 1.253563433 1.35555315 4.164032
[62,] 0.1344048716 0.334263433 0.69162952 4.844032
[63,] 0.1487305153 -0.634036567 0.37670589 4.010732
[64,] 0.1420063384 -0.159036567 1.22928226 3.190732
[65,] 0.1469999823 -0.707536567 1.67200000 1.200732
> library(car)
Attaching package `car':

        The following object(s) are masked from package:base :
         dfbetas rstudent
> library(lmtest)
> lmy=lm(y[-c(1,2)]~y[-c(1,65)]+y[-c(64,65)]+I(x-z-w)[-c(64,65)]-1,data=as.ts(ydata))
> dwtest(lmy)
        Durbin-Watson test
data: lmy
DW = 2.0077, p-value = 0.4404
> durbin.watson(lmy)
 lag Autocorrelation D-W Statistic p-value
   1 -0.01370151 2.007701 0.92
>
So, which P-value should I adopt 0.44 or 0.92?
Thank you for your help.
Ahmad Abu Hammour
  
----- Original Message -----
From: Torsten Hothorn
Sent: Friday, April 19, 2002 4:51 AM
To: Ahmad Abu Hammour
Cc: R-help@stat.math.ethz.ch
Subject: Re: [R] Durbin-Watson test in packages "car" and "lmtest"
  
> 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,
> Ahmad Abu Hammour
>


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Wed 16 Oct 2002 - 11:57:12 EST