From Kurt.Hornik at wu-wien.ac.at  Thu Oct 23 13:04:15 2003
From: Kurt.Hornik at wu-wien.ac.at (Kurt Hornik)
Date: Thu Oct 23 13:06:09 2003
Subject: [Rd] Something strange in cor.test in R-1.8.0 (PR#4718)
In-Reply-To: <200310221409.h9ME960P014577@pubhealth.ku.dk>
References: <200310221409.h9ME960P014577@pubhealth.ku.dk>
Message-ID: <16279.46511.714468.14454@mithrandir.hornik.net>

>>>>> maechler  writes:

>>>>> "Duncan" == Duncan Murdoch <dmurdoch@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

I get the same on Debian GNU/Linux.

Where do we stand on this?  Windows-specific?

-k


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