<HTML><BODY STYLE="font:10pt verdana; border:none;"><DIV><FONT face="Courier New, Courier, Monospace">Hi Torsten,</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace">Here is an example in which P-values have a significant difference. The data is a sub sample of a larger one.</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace">Basically the model I am using is as follows:</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace">y_{t+2}= y_{t+1} + y_t + I(x_{t+1}-z_{t+1}-w_{t+1}) +e_{t+2}</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace"></FONT> </DIV> <DIV><FONT face="Courier New, Courier, Monospace">> ydata</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace"> y z w x</FONT></DIV> <DIV><FONT face="Courier New"> [1,] 0.0101705342 -5.363636567 0.80677087 -2.425968<BR> [2,] -0.0040963887 -4.930336567 -0.01515276 -1.852668<BR> [3,] 0.0007996203 -2.795136567 0.28412361 -0.849268<BR> [4,] 0.0231375722 -2.523036567 -0.33650002 -0.315968<BR> [5,] 0.0576658597 -2.925936567 -0.68112365 0.060732<BR> [6,] 0.0930807057 -2.283836567 -1.59374728 0.214032<BR> [7,] 0.0904861271 -1.908436567 -3.15057091 0.347332<BR> [8,] 0.0815802452 -3.063936567 -3.60669454 -0.175968<BR> [9,] 0.0463679856 -3.947236567 -2.89361816 -1.012668<BR>[10,] 0.0283314000 -3.528136567 -1.68974179 -1.522668<BR>[11,] 0.0158693958 -2.890536567 -1.03456542 -1.629268<BR>[12,] -0.0177988767 -2.165736567 -0.23008905 -1.532668<BR>[13,] -0.0263232785 -2.400436567 -0.29991268 -1.369268<BR>[14,] -0.0377695478 -3.243136567 -0.31953631 -0.539268<BR>[15,] -0.0520095622 -3.241336567 0.22174006 0.120732<BR>[16,] -0.0773138815 -2.765236567 -0.22328356 1.467332<BR>[17,] -0.0804307590 -2.833236567 0.09209281 2.107332<BR>[18,] -0.0446189151 -3.710136567 0.57246918 2.057332<BR>[19,] -0.0439761920 -4.232636567 0.11764555 2.687332<BR>[20,] -0.0508314286 -3.445136567 0.91252192 4.874032<BR>[21,] -0.0373526376 -2.123836567 1.03269829 5.340732<BR>[22,] -0.0363366045 -4.549336567 1.16137466 3.614032<BR>[23,] -0.0119795294 -4.660636567 2.10495103 1.744032<BR>[24,] -0.0271166745 0.940863433 2.73172741 5.450732<BR>[25,] -0.0319279899 2.972463433 3.93230378 7.954032<BR>[26,] -0.0285519284 2.601663433 4.25698015 9.447332<BR>[27,] -0.0362890374 3.900363433 4.49975652 11.397332<BR>[28,] -0.0193261619 2.440563433 4.24003289 7.057332<BR>[29,] -0.0211604332 4.133063433 3.62460926 5.907332<BR>[30,] -0.0393599621 4.764863433 3.78798563 6.740732<BR>[31,] -0.0368496844 2.967363433 3.09016201 5.137332<BR>[32,] -0.0111656400 2.374163433 2.32173838 1.820732<BR>[33,] -0.0049543837 2.858663433 0.59471475 0.570732<BR>[34,] -0.0085112660 3.900063433 -0.96020888 0.424032<BR>[35,] 0.0002988086 3.956163433 -1.40353251 0.500732<BR>[36,] -0.0021387277 2.276463433 -1.99135614 0.720732<BR>[37,] -0.0143497002 2.857863433 -1.40157977 1.270732<BR>[38,] -0.0459512047 3.589163433 -1.78060340 2.574032<BR>[39,] -0.0620556482 4.248163433 -2.43422702 3.537332<BR>[40,] -0.0665723041 3.225363433 -2.45305065 1.830732<BR>[41,] -0.0990262190 2.638163433 -2.34577428 1.634032<BR>[42,] -0.0993943457 2.160963433 -2.00509791 0.780732<BR>[43,] -0.0896954664 1.651763433 -1.79992154 0.164032<BR>[44,] -0.1047509912 2.106963433 -1.59274517 0.117332<BR>[45,] -0.1188326548 3.230463433 -1.40576880 2.007332<BR>[46,] -0.1012159404 2.484063433 -1.60469242 -0.209268<BR>[47,] -0.0975617833 2.185163433 -1.23841605 -0.442668<BR>[48,] -0.0859923186 1.244563433 -0.99983968 -0.495968<BR>[49,] -0.0467949427 -0.185636567 -1.19776331 -1.649268<BR>[50,] -0.0351160760 -0.510836567 -0.50778694 -0.569268<BR>[51,] -0.0233943108 -0.356136567 -0.53781057 0.347332<BR>[52,] -0.0080094290 0.005063433 -0.71733420 -0.569268<BR>[53,] 0.0312603960 -0.149336567 -0.69205783 -0.349268<BR>[54,] 0.0614944090 0.181063433 -0.76188145 0.237332<BR>[55,] 0.0775709808 0.795863433 -0.58080508 1.110732<BR>[56,] 0.0952235601 1.131763433 -0.38712871 1.907332<BR>[57,] 0.1069545973 1.509763433 0.06534766 2.887332<BR>[58,] 0.1136253179 1.785763433 0.64482403 3.450732<BR>[59,] 0.1275201332 1.348463433 1.06650040 3.410732<BR>[60,] 0.1387864450 0.581263433 1.05767677 3.444032<BR>[61,] 0.1244438565 1.253563433 1.35555315 4.164032<BR>[62,] 0.1344048716 0.334263433 0.69162952 4.844032<BR>[63,] 0.1487305153 -0.634036567 0.37670589 4.010732<BR>[64,] 0.1420063384 -0.159036567 1.22928226 3.190732<BR>[65,] 0.1469999823 -0.707536567 1.67200000 1.200732<BR>> library(car)</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace">Attaching package `car':</FONT></DIV> <DIV><BR><FONT face="Courier New, Courier, Monospace"> The following object(s) are masked from package:base :</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace"> dfbetas rstudent </FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace">> library(lmtest)<BR>> 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))<BR>> dwtest(lmy)</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace"> Durbin-Watson test</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace">data: lmy <BR>DW = 2.0077, p-value = 0.4404</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace">> durbin.watson(lmy)<BR> lag Autocorrelation D-W Statistic p-value<BR> 1 -0.01370151 2.007701 0.92<BR>> <BR>So, which P-value should I adopt 0.44 or 0.92?</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace">Thank you for your help.</FONT></DIV> <DIV><FONT face="Courier New">Ahmad Abu Hammour</FONT></DIV> <DIV> </DIV> <BLOCKQUOTE style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style="FONT: 10pt Arial"><FONT face="Courier New, Courier, Monospace">----- Original Message -----</FONT></DIV> <DIV style="BACKGROUND: #e4e4e4; FONT: 10pt Arial; COLOR: black"><FONT face="Courier New, Courier, Monospace"><B>From:</B> Torsten Hothorn</FONT></DIV> <DIV style="FONT: 10pt Arial"><FONT face="Courier New, Courier, Monospace"><B>Sent:</B> Friday, April 19, 2002 4:51 AM</FONT></DIV> <DIV style="FONT: 10pt Arial"><FONT face="Courier New, Courier, Monospace"><B>To:</B> Ahmad Abu Hammour</FONT></DIV> <DIV style="FONT: 10pt Arial"><FONT face="Courier New, Courier, Monospace"><B>Cc:</B> R-help@stat.math.ethz.ch</FONT></DIV> <DIV style="FONT: 10pt Arial"><FONT face="Courier New, Courier, Monospace"><B>Subject:</B> Re: [R] Durbin-Watson test in packages "car" and "lmtest"</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace"> </FONT></DIV><FONT face="Courier New, Courier, Monospace">> Hi,<BR>> P-values in Durbin-Watson test obtained through the use of<BR>> functions available in packages "lmtest" and "car" are different. The<BR>> difference is quite significant. function "dwtest" in "lmtest" is much<BR>> faster than "burbinwatson" in "car". Actually, you can take a nap while<BR>> the latter trying to calculated Durbin-Watson test. My question is which<BR>> p-value is better?<BR><BR>The answer is essencially given in ?durbin.watson and ?dwtest. The latter<BR>states that<BR><BR>The p value is computed<BR> using a Fortran version of the Applied Statistics Algorithm AS 153<BR> by Farebrother (1980, 1984). This algorithm is called "pan" or<BR> "gradsol". For large sample sizes the algorithm might fail to<BR> compute the p value; in that case a warning is printed and an<BR> approximate p value will be given; this p value is computed using<BR> a normal approximation with mean and variance of the Durbin-Watson<BR> test statistic.<BR><BR>while ?durbin.watson says<BR><BR> simulate: if `TRUE' p-values will be estimated by bootstrapping.<BR><BR>What is a "quite significant" difference for p-values?<BR><BR>Looking at the example from ?durbin.watson gives:<BR><BR>R> durbin.watson(lm(fconvict ~ tfr + partic + degrees + mconvict,<BR>data=Hartnagel))<BR>lag Autocorrelation D-W Statistic p-value<BR> 1 0.688345 0.6168636 0<BR>R> dwtest(fconvict ~ tfr + partic + degrees + mconvict, data=Hartnagel)<BR><BR> Durbin-Watson test<BR><BR>data: fconvict ~ tfr + partic + degrees + mconvict<BR>DW = 0.6169, p-value = 6.96e-09<BR><BR>which is fairly close, so you might give us more details (that is: a<BR>working example) to see what the "difference" is (that is: a bug in<BR>either function or a difference due to simulation error / bad<BR>approximation ...).<BR><BR>Torsten<BR><BR>><BR>> Thank you,<BR>> Ahmad Abu Hammour<BR>><BR><BR></FONT></BLOCKQUOTE></BODY></HTML>