The Spearman correlation coefficient is defined as the Pearson correlation coefficient between the rank variables.
For a sample of size $n$, the $n$ raw scores $X_i,Y_i$ are converted to ranks $R(X_i),R(Y_i)$, and the Spearman's rank correlation coefficient is computed as
$$
r_s=\rho_{R(X),R(Y)}=\frac{cov(R(X)R(Y))}{\sigma_{R(X)}\sigma_{R(Y)}}
$$
1. $cov(R(X)R(Y))$: The covariance of the rank variables
2. $\sigma_{R(X)}$ and $\sigma_{R(Y)}$: The standard deviations of the rank variables
Only if all $n$ ranks are distinct integers, it can be computed using the popular formula
$$
r_s=1-\frac{6\sum d_i^2}{n(n^2-1)}
$$
1. $d_i$: $R(X_i)-R(Y_i)$
2. $n$: The number of observations
# Properties
1. The value of $r_s$ is in $[-1,1]$
2. If the relationship between $X$ and $Y$ is positive, then $r_s$ will be positive. If the relationship between $X$ and $Y$ is negative, then $r_s$ will be negative.
3. If there is no relationship between $X$ and $Y$, then $r_s$ will be $0$.
4. It measures monotonic relationships (whether linear or not). This means that Spearman's correlation can capture increasing or decreasing relationships where Pearson's may not.
**References**
* [Spearman's rank correlation coefficient - Wikipedia](https://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient)