Solved – Spearman Correlation Coefficient is more than one

correlationspearman-rho

I am comparing the ranking of two lists. The lists are not very nicely correlated and the number of items is very large (6630). Is it possible to have a correlation coefficient of more than one. I followed the following link:

https://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient#Definition_and_calculation

My code gives correct result for the hours and tv example. However, when I run the same on the large list, the ranking correlation is more than one. I am not able to figure out why.

Best Answer

Note that from the formula on the page you link to the sample value of $\rho_s$ is $1-\frac{\sum_i 6d_i^2}{n(n^2-1)}$.

Consequently, to get a value bigger than 1, $\sum d_i^2$ would have to be negative (which is not possible).

This suggests a problem with the calculation.

Related Question