# Interpreting the Spearman's Rank Correlation Coefficient output in R. What is 'S'?

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

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

• Thank you, that makes sense. So when reporting the results of the Spearman's Rank, I can exclude this S value and jsut continue with the reporting of Rho and p-value? – TomDallo10 Jul 28 '16 at 10:34
• @TomDallo10 Nobody can tell you what should or should not be reported, since it depends on context, which you have not given. For example, different journals have entirely different standards on some things, and some areas of research have very different expectations. I find some sets of conventions on these things to be baffling and others to be perfectly reasonable, even when they differ. What are the expectations of your audience? (I sure can't guess) – Glen_b Jul 28 '16 at 10:51
• I am currently writing a scientific report looking at the overall temporal change over a tri-annual period looking at various variables such as hard coral cover and coral reef community diveristy, to put it short. The scientific report is not peer-reviewed and is open access - as if it was peer-reviewed i would be able to source the answer. I guess my query is the standard format of which it is reported, hence my assumption of excluding the S value. – TomDallo10 Jul 28 '16 at 11:04
• You're welcome. If your question about the meaning of S is sufficiently answered by my answer, you can click on "accept answer". – Qaswed Jul 28 '16 at 12:01