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

Kurt Hornik Kurt.Hornik at wu-wien.ac.at
Thu Oct 23 13:41:57 MEST 2003


>>>>> Peter Dalgaard writes:

> Kurt Hornik <Kurt.Hornik at wu-wien.ac.at> writes:
>> >>>>> maechler  writes:
>> 
>> >>>>> "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
>> 
>> I get the same on Debian GNU/Linux.
>> 
>> Where do we stand on this?  Windows-specific?

> Probably, but of a nasty kind which I think we need to get to the
> bottom of. As I see it there are two possible causes

> 1. A bug in a Windows library or compiler. Potentially that could
>    affect everything else.
> 2. A bug in ctest that just happens only to cause visible damage on
>    Windows, but perhaps invisible damage elsewhere.

> Either way, I think we need to investigate.

As Brian had written earlier in this thread, we need a reproducible
example.  If Duncan's example can be reproduced on Windows but not on
Linux (and I cannot), odds are in favor of the problem being Windows
specific.

-k



More information about the R-devel mailing list