[R] cor.test(x,x) sometimes produce NaN

Peter Malewski peter.malewski at gmx.de
Fri Sep 21 10:47:07 CEST 2001


In the code
 
for(i in 1:100){zz <- rnorm(10);print(cor.test(zz,zz))}

sometimes a sqrt(0) occures:

24: NaNs produced in: sqrt(1 - r^2) 

in all the other cases a result like

t = Inf, df = 8, p-value = < 2.2e-16 

occures. Does cor.test need some more "inf" - handling?
I found that calculating a cor-matrix with additional 
p-values.
Peter

-- 
P.Malewski, Limmerstr.47, 30451 Hannover, 0511-2135008
At work: http://www.MH-Hannover.de 0511 532 3194 / Fax: 0511 532 3190, 
P.Malewski at tu-bs.de, peter.malewski at gmx.de, malewski.peter at mh-hannover.de.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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