[R] spearman correction

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Dec 1 09:50:43 CET 2004


On Wed, 1 Dec 2004, Branimir K. Hackenberger wrote:

> Who knows which correction (by tied numbers) is used by Spearman-test in
> function cor.test (e.g. cor.test(a,b,method="spearman"))?

Anyone who reads the sources!  The critical line in cor.test.default is

             r <- cor(rank(x), rank(y))

so it uses rank(), and that averages ranks of tied observations.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list