###### Data Types

This reading will teach you the tools and techniques used to organize, visualize,... **Read More**

The Spearman’s rank correlation coefficient is a non-parametric statistical test used to examine whether there is a significant relationship between two sets of data. Like the correlation coefficient, Spearman’s rank correlation can have any value between –1 and +1. A value of 0 indicates no relationship, and values of +1 indicate a perfectly positive correlation, while -1 indicates a perfectly negative correlation.

- Rank the values of variables X and Y in descending order.
- Find the difference (denoted as \(d_i\)) between the rank of the pair values of X and Y.
- Square the difference and calculate the sum of the difference, that is \(\sum d_i\).
- Calculate the Spearman’s rank correlation coefficient as follows:

$$

r_{s}=1-\frac{6 \sum d_{i}^{2}}{n\left(n^{2}-1\right)}

$$

**Example: Calculatig Spearman’s Rank Correlation Coefficient**

An analyst is studying the relationship between returns for two sectors, steel and cement over past 5 years by using spearman’s rank correlation coefficient. The returns of both sectors are provided as under.

$$

\begin{array}{c|c|c}

\textbf { Year } & \textbf { Steel sector returns } & \textbf { Cement sector returns } \\

\hline 1 & 2.5 \% & 3.2 \% \\

\hline 2 & 5 \% & 4.5 \% \\

\hline 3 & 5.6 \% & 4.2 \% \\

\hline 4 & -3 \% & -1.7 \% \\

\hline 5 & 0.5 \% & 1.1 \% \\

\end{array}

$$

The Spearman’s rank correlation coefficient is *closest* to:

**Solution**

$$

\begin{array}{c|c|c|c|c|c|c}

\textbf { Year } & \begin{array}{l}

\textbf { Steel } \\

\textbf { sector } \\

\textbf { returns } \\

\textbf { (X) }

\end{array} & \begin{array}{l}

\textbf { Cement } \\

\textbf { sector } \\

\textbf { returns } \\

\textbf{ (Y) }

\end{array} & \begin{array}{l}

\textbf { Rank of } \\

\textbf { X }

\end{array} & \begin{array}{l}

\textbf { Rank of } \\

\mathrm{Y}

\end{array} & \bf{d} & \bf{d^2} \\

\hline 1 & 2.50 \% & 1.60 \% & 3 & 4 & -1 & 1 \\

\hline 2 & 5 \% & 4.50 \% & 2 & 1 & 1 & 1 \\

\hline 3 & 5.60 \% & 4.20 \% & 1 & 2 & -1 & 1 \\

\hline 4 & -3 \% & -1.70 \% & 5 & 5 & 0 & 0 \\

\hline 5 & 0.50 \% & 2.20 \% & 4 & 3 & 1 & 1 \\

\hline & & & & & \textbf { Sum } & 4 \\

\end{array}

$$

We can now use the formula:

$$ \begin{align} r_{s}&=1-\frac{6 \sum d_{i}^{2}}{n\left(n^{2}-1\right)} \\ &=1- \left[\frac{(6 \times 4)}{ 5 \times (5^2 – 1)}\right] \\ &= 0.8 \end{align} $$