[R] Bug in cor.test - Spearman
Giovanni Petris
GPetris at uark.edu
Fri Nov 7 16:15:35 CET 2003
It works fine for me, on a Sun.
> x<-1:100
> y<-rep(c(2,3,4,5),25)
> cor.test(x,y,m="p")
Pearson's product-moment correlation
data: x and y
t = 0.3837, df = 98, p-value = 0.702
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.1588952 0.2333745
sample estimates:
cor
0.03873177
> cor.test(x,y,m="s")
Spearman's rank correlation rho
data: x and y
S = 160195, p-value = 0.7015
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.03873177
Warning message:
p-values may be incorrect due to ties in: cor.test.default(x, y, m = "s")
> cor.test(x,y,m="s")
Spearman's rank correlation rho
data: x and y
S = 160195, p-value = 0.7015
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.03873177
Warning message:
p-values may be incorrect due to ties in: cor.test.default(x, y, m = "s")
> cor.test(x,y,m="k")
Kendall's rank correlation tau
data: x and y
z = 0.5132, p-value = 0.6078
alternative hypothesis: true tau is not equal to 0
sample estimates:
tau
0.03481553
--
__________________________________________________
[ ]
[ Giovanni Petris GPetris at uark.edu ]
[ Department of Mathematical Sciences ]
[ University of Arkansas - Fayetteville, AR 72701 ]
[ Ph: (479) 575-6324, 575-8630 (fax) ]
[ http://definetti.uark.edu/~gpetris/ ]
[__________________________________________________]
More information about the R-help
mailing list