Re: [R] cor() function, method="spearman"

From: Peter Dalgaard <>
Date: Sat 08 Oct 2005 - 18:18:26 EST writes:

> Hello,
> Does anyone know if the cor function, when method = "spearman", returns a correlation coefficient corrected for any ties in the ranks of the data? I have data with quite a few ties and am thinking that I should use a calculation of the coefficient corrected for ties, but before I try and code this calculation myself, I thought I should check whether or not cor() automatically does this.
> Thank you!
> Joanna McGarvie

The tie-corrected spearman correlation is the correlation of the tie-corrected ranks, so yes, it does do that.

Previous versions of R had an issue with p-values in cor.test, where it used the exact distribution of the test for non-tied data, even when ties were present. This was straightened out in 2.2.0, where it now uses an asymptotic formula instead.

   O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (                  FAX: (+45) 35327907

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Sat Oct 08 18:24:42 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:31:30 EST