The Spearman rank correlation coefficient rs is calculated as below:

spearman rank correlation coefficient formulla

n is the number of pairs of measurements

Di is the difference of the ith pair of rankings