Function cor method="spearman" doesn't work properly

Good day!
I'm trying to find a value of Spearman correlation between two vectors.
The data is here: Ранговая корреляция
The Spearman Correlation Coefficient here is 0.638.

But when I'm trying it in R - the Spearman Correlation Coefficient is 0.484

rx=c(1.5,1.6,2.1,2.1,2.2,2.2,2.3,2.3,2.6,3.0)
ry=c(1.0,3.7,2.4,2.1,3.3,3.6,3.6,2.9,3.0,4.0)
t<-data.frame(rx,ry)
cor(t,method="spearman")

Please, help me - how to count this coefficient properly?

Olga

Hi Olga ,
Welcome to the forum. I am not sure but I think the example in Ранговая корреляция has a mistake in the ranking.

ry for 1958 in Ранги вариант is ranked 6 and I think it should be 9. Therefore, you have the correct result.

rx=c(1.5, 1.6, 2.1, 2.1, 2.2, 2.2, 2.3, 2.3, 2.6, 3.0)
ry=c(1.0, 3.7, 2.4, 2.1, 3.3, 3.6, 3.6, 2.9, 3.0, 4.0)

rank(rx)
rank(ry)
1 Like

jrkrideau, thank you a lot for your quick and useful reply!!
Now I understand :slight_smile:

Best regards,
Olga

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.