Biology, images, analysis, design...
Use/Abuse Principles How To Related
"It has long been an axiom of mine that the little things are infinitely the most important" (Sherlock Holmes)

Search this site



Spearman's rank correlation coefficient - using R

Spearman's rank correlation coefficient

The R output for the Spearman correlation test is as follows:

> cor.test (x,y,method = "spearman") Spearman's rank correlation rho data: x and y S = 2063.483, p-value = 1.697e-06 alternative hypothesis: true rho is not equal to 0 sample estimates: rho 0.7109968 Warning message: In cor.test.default(x, y, method = "spearman") : Cannot compute exact p-values with ties

The test statistic S given in the R output is estimated from:

S = (n3-n) (1-rs)/6
where n is the number of bivariate observations and rs is Spearman's rank correlation coefficient.

Olds (1938) tabulated the exact distribution of S using 'algorithm AS 89'. R uses this algorithm to test the significance of rs. Values are only exact when there are no ties.