1
$\begingroup$

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.

$\endgroup$
5
  • $\begingroup$ 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$? $\endgroup$ – Glen_b Jan 12 '16 at 12:02
  • $\begingroup$ I made a mistake while computing. $\endgroup$ – Ayushi Dalmia Jan 12 '16 at 17:45
  • $\begingroup$ 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. $\endgroup$ – Glen_b Jan 12 '16 at 22:13
  • $\begingroup$ I still don't know. Do you want me to share the code? $\endgroup$ – Ayushi Dalmia Jan 13 '16 at 19:51
  • $\begingroup$ It would be off topic here, so probably best not. It was more idle curiosity. Thanks anyway. $\endgroup$ – Glen_b Jan 13 '16 at 21:21
2
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.