Spearman’s rank-order correlation (often called Spearman’s ρ or rho) is a non-parametric test which measures the monotonic relationship between two ranked variables. This test is often used when Pearson product-moment correlation cannot be used because (one of) the assumptions for the test are challenged. Most of the time, the assumptions of normality and linearity will be a reason for not using Pearson’s product-moment correlation.

Spearman’s rho comes with one main assumption: the monotonicity of the relationship between variables. To better understand what monotonic relationship implies, check the following picture taken from Lærd statistics’ webpage:

Monotonicity of the relationship between two variables As you may understand, as the first variable increases, the second variable must either increase or decrease in a monotonic manner, but not necessarily in a proportional manner.

Let’s check this with an example. Here we consider weather records for the last 12 months in Bergen. The variables are rain and temperature, and we’ll try to see whether there is a form of relationship between these variables.

Normality and equal variance are not to be check here, so let’s draw directly a scatter plot:



Hard to see any obvious relationship…

Let’s check Spearman’s ρ. The function is cor.test(). Note that the function is the same as for Pearson’s r and Kendall’s tau. The extra parameter method=" " defines which correlation coefficient is to be considered in the test (choose between "pearson", "spearman" and "kendall"; if the parameter method is omitted, the default test will be Pearson’s r)

cor.test(rain, temperature, method="spearman")
## 
##  Spearman's rank correlation rho
## 
## data:  rain and temperature
## S = 358, p-value = 0.4301
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##        rho 
## -0.2517483

In this test, the null hypothesis H0 states that there is no relationship between the variables. Here, the p-value is largely greater than 0.05, this null hypothesis cannot be rejected.