[Rd] Something strange in cor.test in R-1.8.0 (PR#4718)

maechler at stat.math.ethz.ch maechler at stat.math.ethz.ch
Wed Oct 22 16:09:06 MEST 2003


>>>>> "Duncan" == Duncan Murdoch <dmurdoch at pair.com>
>>>>>     on Wed, 22 Oct 2003 08:17:32 -0400 writes:

    Duncan> I've now tried the code 

 set.seed(1)
 x <- rnorm(50)
 y <- rnorm(50)
 cor.test(x,y,method="spearman")
 x <- rnorm(50)
 y <- rnorm(50)
 cor.test(x,y,method="spearman")

    Duncan> in r-patched (which gives apparently correct results), and r-devel,
    Duncan> which gives the first result correct, the second incorrect; when
    Duncan> repeated, both are bad.
Hmm,
funny.

I get repeatable results in in R 1.7.1 , 1.8.0, R-patched and
R-devel (all on Linux),

with an (ugly but convenient) 1-liner :

> set.seed(1); for(k in 1:2){x <- rnorm(50);y <- rnorm(50);print(unlist(cor.test(x,y,method="spearman")[1:4]))}
  statistic.S       p.value  estimate.rho 
23640.0000000     0.3482088    -0.1351741 
 statistic.S      p.value estimate.rho 
1.724800e+04 2.322263e-01 1.717647e-01 

---
Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><



More information about the R-devel mailing list