[R] warning message

Rui Cerqueira ruimanuelcerqueira at hotmail.com
Tue Nov 20 13:12:08 CET 2001

   Hello everybody.

   I would like to pose a question regarding a warning message after running 
a function of my own. The function I created for computing the p-value of 
the dw statistic has a command line like this:

»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) }

, with arguments "dw" as a real and "eigen" as a vector.
   After I run:

»dwf0(1.314416,c(3.4420282, 2.6472097, 1.8375986, 1.2928912, 0.6768543, 
0.4187899, 0.1058144))

, the console replies:

»[1] 0.3576019
»There were 50 or more warnings (use warnings() to see the first 50)

. The first 50 warnings are similar to this (the first):

»1: longer object length
»        is not a multiple of shorter object length in: 2 * (eigen - dw)* 
0+1i * x

. Altough R gives a solution (0.3576019), I wasn't able to confirm this 
value until now and I can't get rid of that warning message. I did a "trial 
and error" on subdivisions to get a mid-term between a "out of memory" and a 
"maximum number of subdivisions reached".
   I thank you for your time on reading my message.


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

More information about the R-help mailing list