Hello Uwe First, I want to thank you for spending your time replying to my mail. I'm very impressed with the speed that my question was answered. I'm new at R (about two weeks) and reading your mail made me realize that it was indeed a question of vectors of different lengths. I thinked that I could create a function ("carfun") without creating a "x" vector, since the only purpose of that function is to be integrated right away in the same "x" (I re-posted my function again at the end). But now I have another question: since "x" must be of "(dw-eigen)"'s length, how can I create a polynom in "x" of variable degree (=length("(dw-eigen)")) to be integrated? The computation of the exact p-value of DW is a hard one (since it depends on X matrices and the formula is a bit complicated), but the DW statistic is a valuable calculation in econometrics. The package "lmtest" has a function "dwtest", but it doesn't give any p-value. Thank you once more.> > »dwf0 <- function(dw,eigen) { carfun <- function(x) { > > >(prod(1+2*(eigen-dw)*1i*x)^(-1/2)-prod(1-2*(eigen-dw)*1i*x)^(-1/2))/(1i*x) >} > > ; 1/2+integrate(f=carfun,lower = 0,upper = Inf, > > subdivisions=10000)$value/(2*pi) }_________________________________________________________________ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Rui Cerqueira wrote:> > Hello Uwe > > First, I want to thank you for spending your time replying to my mail. I'm > very impressed with the speed that my question was answered. > I'm new at R (about two weeks) and reading your mail made me realize that it > was indeed a question of vectors of different lengths. I thinked that I > could create a function ("carfun") without creating a "x" vector, since the > only purpose of that function is to be integrated right away in the same "x" > (I re-posted my function again at the end). > But now I have another question: since "x" must be of "(dw-eigen)"'s > length, how can I create a polynom in "x" of variable degree > (=length("(dw-eigen)")) to be integrated? The computation of the exact > p-value of DW is a hard one (since it depends on X matrices and the formula > is a bit complicated), but the DW statistic is a valuable calculation in > econometrics. The package "lmtest" has a function "dwtest", but it doesn't > give any p-value.Not yet. We're still working on the last refinements of a new version of "lmtest", hopefully out on CRAN by the end of the month. For the moment you can either use the function durbin.watson() in "car", which gives a bootstrapped p-value or I could send you a snapshot of the forthcoming "lmtest", which calculates the p-values with the "pan" or "gradsol" algorithm (which seems to be quite similar to your approach). Best, Z> Thank you once more. > > > > ?dwf0 <- function(dw,eigen) { carfun <- function(x) { > > > > >(prod(1+2*(eigen-dw)*1i*x)^(-1/2)-prod(1-2*(eigen-dw)*1i*x)^(-1/2))/(1i*x) > >} > > > ; 1/2+integrate(f=carfun,lower = 0,upper = Inf, > > > subdivisions=10000)$value/(2*pi) } > > _________________________________________________________________ > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hello Achim I would appreciate very much the snapshot you told, even for learning purpose (developing is, in my opinion, a bit soon). Nevertheless, I'm going to look at the durbin.watson() in "car". I can't stop saying how admired I am with the quickness my question was solved. Thanks to all.>From: Achim Zeileis <zeileis at ci.tuwien.ac.at> >To: Rui Cerqueira <ruimanuelcerqueira at hotmail.com> >CC: ligges at statistik.uni-dortmund.de, r-help at stat.math.ethz.ch >Subject: Re: [R] dw statistic >Date: Wed, 21 Nov 2001 13:38:30 +0100 > >Rui Cerqueira wrote: > > > > Hello Uwe > > > > First, I want to thank you for spending your time replying to my mail. >I'm > > very impressed with the speed that my question was answered. > > I'm new at R (about two weeks) and reading your mail made me realize >that it > > was indeed a question of vectors of different lengths. I thinked that I > > could create a function ("carfun") without creating a "x" vector, since >the > > only purpose of that function is to be integrated right away in the same >"x" > > (I re-posted my function again at the end). > > But now I have another question: since "x" must be of "(dw-eigen)"'s > > length, how can I create a polynom in "x" of variable degree > > (=length("(dw-eigen)")) to be integrated? The computation of the exact > > p-value of DW is a hard one (since it depends on X matrices and the >formula > > is a bit complicated), but the DW statistic is a valuable calculation in > > econometrics. The package "lmtest" has a function "dwtest", but it >doesn't > > give any p-value. > >Not yet. We're still working on the last refinements of a new version of >"lmtest", hopefully out on CRAN by the end of the month. >For the moment you can either use the function durbin.watson() in "car", >which gives a bootstrapped p-value or I could send you a snapshot of the >forthcoming "lmtest", which calculates the p-values with the "pan" or >"gradsol" algorithm (which seems to be quite similar to your approach). >Best, >Z > > > > Thank you once more. > > > > > > »dwf0 <- function(dw,eigen) { carfun <- function(x) { > > > > > > > >(prod(1+2*(eigen-dw)*1i*x)^(-1/2)-prod(1-2*(eigen-dw)*1i*x)^(-1/2))/(1i*x) > > >} > > > > ; 1/2+integrate(f=carfun,lower = 0,upper = Inf, > > > > subdivisions=10000)$value/(2*pi) } > > > > _________________________________________________________________ > > > > >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > > r-help mailing list -- Read >http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > > Send "info", "help", or "[un]subscribe" > > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > > >_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- >r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html >Send "info", "help", or "[un]subscribe" >(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch >_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.__________________________________________________________________ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Maybe Matching Threads
- warning message
- Durbin-Watson test in packages "car" and "lmtest"
- Comparison of Output from "dwtest" and "durbin.watson"
- where can I find Durbin-Waston test tables for Confidence Level 2.5% or 0.5%?
- Which Durbin-Watson is correct? (weights involved) - using durbinWatsonTest and dwtest (packages car and lmtest)