[R] Test statistic for Spearman correlation
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Thu May 1 19:20:04 CEST 2003
Thomas W Blackwell <tblackw at umich.edu> writes:
> Brett -
>
> I can give you a further reference, but you may not
> find it much help !
>
> E. G. Olds. Distribution of sums of squares of rank
> differences for small numbers of individuals. Annals
> of Mathematical Statistics, v.9, pp. 133-148, 1938.
>
> My source says that "Olds (1938) tabulated the exact
> distribution of a quantity S related to rho by the
> equation
>
> R = 1 - 6 * S / (n^3 - n) ."
>
> Olds must have been using a Comptometer or a Marchant
> calculator, so presumably, this construct guarantees
> always to be an integer. Algorithm AS 89 is certainly
> available on line from Statlib.
The title of Olds paper might have given you a hint:
> x <- rank(rnorm(10))
> y <- rank(rnorm(10))
> cor(x,y)
[1] -0.2242424
> 990/6*(1-cor(x,y))
[1] 202
> sum((x-y)^2)
[1] 202
BTW, the identity breaks down when there are ties, something that we
probably ought to look into at some point. The code does say that the
p values may be incorrect, but I suspect they may be more incorrect
than need be.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list