[R] R's Spearman

Raymond Wan rwan at kuicr.kyoto-u.ac.jp
Tue May 29 07:14:50 CEST 2007


Chung-hong Chan wrote:
> Hi,
> You can try with
> cor.test(rank(y[1]),rank(y[2]))

Thanks for this!  It didn't solve my problem, but it helped me realize 
that the formula I was using by hand is invalid for the tie case.  I 
just realized that with R's cor function, the Pearson correlation of the 
ranks = the Spearman of the original values.

I've yet to find the formula for the tied case for Spearman, but at 
least now I know what the problem is (the formula I was using by hand).  


More information about the R-help mailing list