[R] spearman rank correlation

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Jan 23 08:37:03 CET 2003


kjetil brinchmann halvorsen wrote:
> On 23 Jan 2003 at 11:27, David Alexander wrote:
> 
> Did ypu try to use cor.test?
> 
> 
>>example(cor.test)
> 
> 
> cr.tst> x <- c(44.4, 45.9, 41.9, 53.3, 44.7, 44.1, 50.7, 45.2, 
>     60.1)
> 
> cr.tst> y <- c(2.6, 3.1, 2.5, 5, 3.6, 4, 5.2, 2.8, 3.8)
> 
> cr.tst> cor.test(x, y, method = "kendall", alternative = "greater")

[snip]

Almost - David was looking for Spearman's rho.
David should have tried it out with method="spearman" and ?cor.test 
tells us in Section "Value":

'estimate: the estimated measure of association, with name "cor", "tau", 
or "rho" correspoding to the method employed.'



>>hello help,
>>
>>i've searched through the manual pages and the only reference i can find to spearman rank correlation is cor.test, which only seems to give the significance value of the correlation.
>>
>>is there any way to get the actual value of rho?
>>
>>david.




More information about the R-help mailing list