# Spearman's Rank Correlation

Spearman's rank correlation provides a distribution free test of independence between two variables. It is, however, insensitive to some types of dependence. Kendall's rank correlation gives a better measure of correlation and is also a better two sided test for independence.

Spearman's rank correlation coefficient (r or rho) is calculated as:

- where R(x) and R(y) are the ranks of a pair of variables (x and y) each containing n observations.

Technical Validation

Rho is calculated as Pearson's r based on ranks and average ranks using the above formula. The probability associated with r, when there are no tied ranks present, is evaluated using an exact permutational method when n = 10 and an Edgeworth series approximation when n > 10 (Best and Roberts, 1975). The exact probability calculation employs a corrected version of the Best and Roberts (1975) algorithm, which was further improved in version 3 of StatsDirect. When ties are present the standard asymptotic approximation [2_tailed_t(df=n-2,t=|rho|sqrt(n-2)/sqrt(1-rho^2)]) is used. A confidence interval for rho is constructed using Fisher's z transformation (Conover, 1999; Gardner and Altman, 1989; Hollander and Wolfe, 1973). Note that StatsDirect uses more accurate definitions of rho and the probabilities associated with it than some other statistical software, therefore, there may be differences in results: for example, using the data below in version 3.2.2 of R will give different P values from the corr.test function compared with the spearman.test function of the pspearman package because the mistake in AS89 has been carried over from the original FORTRAN.

Example

Test workbook (Nonparametric worksheet: Career, Psychology).

The following data represent a tutor's ranking of ten clinical psychology students as to their suitability for their career and their knowledge of psychology:

 Career Psychology 4 5 10 8 3 6 1 2 9 10 2 3 6 9 7 4 8 7 5 1

To analyse these data in StatsDirect you must first enter them into two columns in the workbook. Alternatively, open the test workbook using the file open function of the file menu. Then select Spearman Rank Correlation from the Nonparametric section of the analysis menu. Select the columns marked "Career" and "Psychology" when prompted for data.

For this example:

Spearman's rank correlation coefficient (Rho)= 0.684848

95% CI for rho (Fisher's z transformed)= 0.097085 to 0.918443

Upper side (H1 positive correlation) P = .0173

Lower side (H1 negative correlation) P = .9827

Two sided (H1 any correlation) P = .0347

From these results we reject the null hypothesis of mutual independence between the tutor's ranking of students suitability for their career and their knowledge of psychology. With a two sided test we are considering the possibility of a positive or a negative correlation, i.e. we can't be sure of this direction at the outset. A one sided test would have been restricted to correlation in one direction only i.e. large values of one group associated with big values of the other (positive correlation) or large values of one group associated with small values of the other (negative correlation). In our example we can conclude that there is a statistically significant lack of independence between career suitability and psychology knowledge rankings of the students by the tutor. The tutor tended to rank students with apparently greater knowledge as more suitable to their career than those with apparently less knowledge and vice versa.