# Spearman Correlation Coefficient is more than one

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.

• It's going to be difficult to figure out on the information given. Note that from the formula on the page you link to, to get a value bigger than 1, $\sum d_i^2$ would have to be negative (which is not possible). What value did you get for $\sum d_i^2$? – Glen_b Jan 12 '16 at 12:02
• I made a mistake while computing. – Ayushi Dalmia Jan 12 '16 at 17:45
• It would be interesting to see how you can have had the correct answer on the example from the wikipedia page if the code was wrong. – Glen_b Jan 12 '16 at 22:13
• I still don't know. Do you want me to share the code? – Ayushi Dalmia Jan 13 '16 at 19:51
• It would be off topic here, so probably best not. It was more idle curiosity. Thanks anyway. – Glen_b Jan 13 '16 at 21:21

## 1 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.