Solved – Interpreting the Spearman’s Rank Correlation Coefficient output in R. What is ‘S’

correlationrspearman-rho

I just need some clarification regarding the interpretation of the Spearman's Rank Correlation Coefficient output in R. I am currently determining correlations over a tri-nominal temporal scale in an ecological setting. My basic code is as below:

cor.test(v1,v2,method="spearman")

and the example output is as follows:

Spearman's rank correlation rho

data: v1 and v2
S = 466770, p-value = 0.4601
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.06203443

I understand the output for the rho and p values however i cannot find a definitive answer for what 'S' is? Am i required to report this value? Any clarification will be much welcomed.

Thanks

Best Answer

S is the test statistic which is the sum of all squared rank differences. To make it more understandable. Assume we have to following data:

v1 <- c(1, 2, 3, 4)
v2 <- c(3, 4, 2, 1)

Now, we get the ranks.

#v1 rank(v1)  v2  rank(v2) d = |rank(v2) - rank (v1)|  d^2
# 1        4   3         2                          2    4
# 2        3   4         1                          2    4 
# 3        2   2         3                          1    1
# 4        1   1         4                          3    9

The sum over all d^2 is 4 + 4 + 1 + 9 = 18. (Another example can be found here: https://statistics.laerd.com/statistical-guides/spearmans-rank-order-correlation-statistical-guide-2.php)

We find the same thing in R:

test <- cor.test(v1,v2,method="spearman")
test$statistic #S is 18

S is derived from random variables and can be assumed to have a distribution (like a t-distribution or normal-distribution). And depending on the distribution and their parameters you can say how likeli it is to observe this (or a more extreme) value under this distribution. This is your p-value.

In moste cases I would say that the major part of the readers is happy with the correlation-coefficient, the p-value and the cases numbers ("n"). But this is a next question that would better fit at https://academia.stackexchange.com/.

Related Question