[R] R's Spearman

Raymond Wan rwan at kuicr.kyoto-u.ac.jp
Sun Jun 3 18:20:02 CEST 2007


Dear Frank and Felipe,

Thank you both for your replies.  The code looks exactly like the 
formula in Japanese wikipedia which I was trying to make sense of (as it 
wasn't in English wikipedia).  Thank you for sharing your code with, Felipe!

And the clarification, Frank.  Knowing many ways of calculating it helps 
understanding it...thanks to both of you!

Ray


Frank E Harrell Jr wrote:
> Mendiburu, Felipe (CIP) wrote:
>> Dear Ray,
>>
>> The R's Spearman calculated by R is correct for ties or nonties, 
>> which is not correct is the probability for the case of ties. I send 
>> to you formulates it for the correlation with ties, that is equal to R.
>> Regards,
>>
>> Felipe de Mendiburu
>> Statistician
>
> Just use midranks for ties (as with rank()) and compute the ordinary 
> correlation on those (see also the spearman2 and rcorr functions in 
> Hmisc package).  No need to use complex formulas.  And the t 
> approximation for p-values works pretty well.



More information about the R-help mailing list