cor() function, method="spearman"
jlmcgarv at sfu.ca 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 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907