<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 +&nbsp;I(x_{t+1}-z_{t+1}-w_{t+1}) +e_{t+2}</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace"></FONT>&nbsp;</DIV> <DIV><FONT face="Courier New, Courier, Monospace">&gt; ydata</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; y&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; z&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x</FONT></DIV> <DIV><FONT face="Courier New">&nbsp;[1,]&nbsp; 0.0101705342 -5.363636567&nbsp; 0.80677087 -2.425968<BR>&nbsp;[2,] -0.0040963887 -4.930336567 -0.01515276 -1.852668<BR>&nbsp;[3,]&nbsp; 0.0007996203 -2.795136567&nbsp; 0.28412361 -0.849268<BR>&nbsp;[4,]&nbsp; 0.0231375722 -2.523036567 -0.33650002 -0.315968<BR>&nbsp;[5,]&nbsp; 0.0576658597 -2.925936567 -0.68112365&nbsp; 0.060732<BR>&nbsp;[6,]&nbsp; 0.0930807057 -2.283836567 -1.59374728&nbsp; 0.214032<BR>&nbsp;[7,]&nbsp; 0.0904861271 -1.908436567 -3.15057091&nbsp; 0.347332<BR>&nbsp;[8,]&nbsp; 0.0815802452 -3.063936567 -3.60669454 -0.175968<BR>&nbsp;[9,]&nbsp; 0.0463679856 -3.947236567 -2.89361816 -1.012668<BR>[10,]&nbsp; 0.0283314000 -3.528136567 -1.68974179 -1.522668<BR>[11,]&nbsp; 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&nbsp; 0.22174006&nbsp; 0.120732<BR>[16,] -0.0773138815 -2.765236567 -0.22328356&nbsp; 1.467332<BR>[17,] -0.0804307590 -2.833236567&nbsp; 0.09209281&nbsp; 2.107332<BR>[18,] -0.0446189151 -3.710136567&nbsp; 0.57246918&nbsp; 2.057332<BR>[19,] -0.0439761920 -4.232636567&nbsp; 0.11764555&nbsp; 2.687332<BR>[20,] -0.0508314286 -3.445136567&nbsp; 0.91252192&nbsp; 4.874032<BR>[21,] -0.0373526376 -2.123836567&nbsp; 1.03269829&nbsp; 5.340732<BR>[22,] -0.0363366045 -4.549336567&nbsp; 1.16137466&nbsp; 3.614032<BR>[23,] -0.0119795294 -4.660636567&nbsp; 2.10495103&nbsp; 1.744032<BR>[24,] -0.0271166745&nbsp; 0.940863433&nbsp; 2.73172741&nbsp; 5.450732<BR>[25,] -0.0319279899&nbsp; 2.972463433&nbsp; 3.93230378&nbsp; 7.954032<BR>[26,] -0.0285519284&nbsp; 2.601663433&nbsp; 4.25698015&nbsp; 9.447332<BR>[27,] -0.0362890374&nbsp; 3.900363433&nbsp; 4.49975652 11.397332<BR>[28,] -0.0193261619&nbsp; 2.440563433&nbsp; 4.24003289&nbsp; 7.057332<BR>[29,] -0.0211604332&nbsp; 4.133063433&nbsp; 3.62460926&nbsp; 5.907332<BR>[30,] -0.0393599621&nbsp; 4.764863433&nbsp; 3.78798563&nbsp; 6.740732<BR>[31,] -0.0368496844&nbsp; 2.967363433&nbsp; 3.09016201&nbsp; 5.137332<BR>[32,] -0.0111656400&nbsp; 2.374163433&nbsp; 2.32173838&nbsp; 1.820732<BR>[33,] -0.0049543837&nbsp; 2.858663433&nbsp; 0.59471475&nbsp; 0.570732<BR>[34,] -0.0085112660&nbsp; 3.900063433 -0.96020888&nbsp; 0.424032<BR>[35,]&nbsp; 0.0002988086&nbsp; 3.956163433 -1.40353251&nbsp; 0.500732<BR>[36,] -0.0021387277&nbsp; 2.276463433 -1.99135614&nbsp; 0.720732<BR>[37,] -0.0143497002&nbsp; 2.857863433 -1.40157977&nbsp; 1.270732<BR>[38,] -0.0459512047&nbsp; 3.589163433 -1.78060340&nbsp; 2.574032<BR>[39,] -0.0620556482&nbsp; 4.248163433 -2.43422702&nbsp; 3.537332<BR>[40,] -0.0665723041&nbsp; 3.225363433 -2.45305065&nbsp; 1.830732<BR>[41,] -0.0990262190&nbsp; 2.638163433 -2.34577428&nbsp; 1.634032<BR>[42,] -0.0993943457&nbsp; 2.160963433 -2.00509791&nbsp; 0.780732<BR>[43,] -0.0896954664&nbsp; 1.651763433 -1.79992154&nbsp; 0.164032<BR>[44,] -0.1047509912&nbsp; 2.106963433 -1.59274517&nbsp; 0.117332<BR>[45,] -0.1188326548&nbsp; 3.230463433 -1.40576880&nbsp; 2.007332<BR>[46,] -0.1012159404&nbsp; 2.484063433 -1.60469242 -0.209268<BR>[47,] -0.0975617833&nbsp; 2.185163433 -1.23841605 -0.442668<BR>[48,] -0.0859923186&nbsp; 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&nbsp; 0.347332<BR>[52,] -0.0080094290&nbsp; 0.005063433 -0.71733420 -0.569268<BR>[53,]&nbsp; 0.0312603960 -0.149336567 -0.69205783 -0.349268<BR>[54,]&nbsp; 0.0614944090&nbsp; 0.181063433 -0.76188145&nbsp; 0.237332<BR>[55,]&nbsp; 0.0775709808&nbsp; 0.795863433 -0.58080508&nbsp; 1.110732<BR>[56,]&nbsp; 0.0952235601&nbsp; 1.131763433 -0.38712871&nbsp; 1.907332<BR>[57,]&nbsp; 0.1069545973&nbsp; 1.509763433&nbsp; 0.06534766&nbsp; 2.887332<BR>[58,]&nbsp; 0.1136253179&nbsp; 1.785763433&nbsp; 0.64482403&nbsp; 3.450732<BR>[59,]&nbsp; 0.1275201332&nbsp; 1.348463433&nbsp; 1.06650040&nbsp; 3.410732<BR>[60,]&nbsp; 0.1387864450&nbsp; 0.581263433&nbsp; 1.05767677&nbsp; 3.444032<BR>[61,]&nbsp; 0.1244438565&nbsp; 1.253563433&nbsp; 1.35555315&nbsp; 4.164032<BR>[62,]&nbsp; 0.1344048716&nbsp; 0.334263433&nbsp; 0.69162952&nbsp; 4.844032<BR>[63,]&nbsp; 0.1487305153 -0.634036567&nbsp; 0.37670589&nbsp; 4.010732<BR>[64,]&nbsp; 0.1420063384 -0.159036567&nbsp; 1.22928226&nbsp; 3.190732<BR>[65,]&nbsp; 0.1469999823 -0.707536567&nbsp; 1.67200000&nbsp; 1.200732<BR>&gt; library(car)</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace">Attaching package `car':</FONT></DIV> <DIV><BR><FONT face="Courier New, Courier, Monospace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The following object(s) are masked from package:base :</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dfbetas rstudent </FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace">&gt; library(lmtest)<BR>&gt; 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>&gt; dwtest(lmy)</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Durbin-Watson test</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace">data:&nbsp; lmy <BR>DW = 2.0077, p-value = 0.4404</FONT></DIV> <DIV><FONT face="Courier New, Courier, Monospace">&gt; durbin.watson(lmy)<BR>&nbsp;lag Autocorrelation D-W Statistic p-value<BR>&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp; -0.01370151&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2.007701&nbsp;&nbsp;&nbsp; 0.92<BR>&gt; <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>&nbsp;</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">&nbsp;</FONT></DIV><FONT face="Courier New, Courier, Monospace">&gt; Hi,<BR>&gt; P-values in Durbin-Watson test obtained through the use of<BR>&gt; functions available in packages "lmtest" and "car" are different. The<BR>&gt; difference is quite significant. function "dwtest" in "lmtest" is much<BR>&gt; faster than "burbinwatson" in "car". Actually, you can take a nap while<BR>&gt; the latter trying to calculated Durbin-Watson test. My question is which<BR>&gt; 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>&nbsp;&nbsp;&nbsp;&nbsp; using a Fortran version of the Applied Statistics Algorithm AS 153<BR>&nbsp;&nbsp;&nbsp;&nbsp; by Farebrother (1980, 1984). This algorithm is called "pan" or<BR>&nbsp;&nbsp;&nbsp;&nbsp; "gradsol". For large sample sizes the algorithm might fail to<BR>&nbsp;&nbsp;&nbsp;&nbsp; compute the p value; in that case a warning is printed and an<BR>&nbsp;&nbsp;&nbsp;&nbsp; approximate p value will be given; this p value is computed using<BR>&nbsp;&nbsp;&nbsp;&nbsp; a normal approximation with mean and variance of the Durbin-Watson<BR>&nbsp;&nbsp;&nbsp;&nbsp; test statistic.<BR><BR>while ?durbin.watson says<BR><BR>&nbsp; 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&gt; durbin.watson(lm(fconvict ~ tfr + partic + degrees + mconvict,<BR>data=Hartnagel))<BR>lag Autocorrelation D-W Statistic p-value<BR>&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.688345&nbsp;&nbsp;&nbsp;&nbsp; 0.6168636&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<BR>R&gt; dwtest(fconvict ~ tfr + partic + degrees + mconvict, data=Hartnagel)<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Durbin-Watson test<BR><BR>data:&nbsp; 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>&gt;<BR>&gt; Thank you,<BR>&gt; Ahmad Abu Hammour<BR>&gt;<BR><BR></FONT></BLOCKQUOTE></BODY></HTML>