Rank correlation coefficient

Posted in Maths,

The Spearman's rank correlation coefficient, denoted by rs is a method of calculating the correleation coefficient for a set of bivariate data by ranking that data.

The formula for the rank correlation coefficient is:

Dynamic image 0

Where d is the difference in ranks and n is the amount of pairs of data.

Example

Two student's marks on 5 tests are compared, their results are given as follows:

Test A B C D
Student A 40 45 42 49
Student B 38 33 40 32

First step is to rank the data, in this case give a rank 1 to the highest value and rank 4 to the lowest value:

Test A B C D
Student A 4 2 3 1
Student B 2 3 1 4

Now calculate the difference in ranks for each pair of data and calculate the squared difference too:

Test A B C D
Student A 4 2 3 1
Student B 2 3 1 4
d 2 -1 2 -3
d2 4 1 4 9

Calculate the sum of the differences squared:

Dynamic image 1

Plug the values into the formula:

Dynamic image 2