## Spearman’s Rank correlation Coefficient

Let `$(x_1, y_1), (x_2, y_2), \cdots , (x_n, y_n)$`

be the ranks of $n$ individuals in two characteristics $A$ and $B$ respectively.

## Formula

Then the Spearman’s rank correlation coefficient is denoted by $\varrho$ and is given by

`$\varrho = 1- \dfrac{6 \sum_{i=1}^{n}d_i^2}{n(n^2-1)}$`

where,

`$d_i = x_i - y_i$`

is the difference between the pairs of ranks of the $i^{th}$ individual in the two characteristics and- $n$ is the number of pairs.

Rank correlation coefficient lies between -1 and +1. i.e. $-1 \leq \varrho \leq +1$.

- If $\varrho =0$, then there is no correlation between the ranks.
- If $\varrho >0$, then there is a positive correlation between the ranks.
- If $\varrho = 1$, then there is a perfect positive correlation between the ranks.
- If $0 <\varrho < 1$, then there is a partially positive correlation between the ranks.

- If $\varrho <0$, then there is a negative correlation between the ranks.
- If $\varrho = -1$, then there is a perfect negative correlation between the ranks.
- If $-1 <\varrho < 0$, then there is a partially negative correlation between the ranks.

## Example 1

The scores given by two judges to 10 participants in a competition are as follows:

Judge A | 30 | 29 | 30 | 47 | 45 | 36 | 47 | 37 | 25 | 47 |
---|---|---|---|---|---|---|---|---|---|---|

Judge B | 31 | 32 | 29 | 46 | 43 | 32 | 46 | 34 | 26 | 45 |

Determine the rank correlation coefficient.

### Solution

Let $x$ denote the scores by Judge A and $y$ denote the scores by Judge B.

Let $R_x$ denote the rank of $x$ and $R_y$ denote the rank of $y$.

$x$ | $y$ | Rank of $x (R_x)$ | Rank of $y (R_y)$ | $d=R_x-R_y$ | d^2 | |
---|---|---|---|---|---|---|

1 | 30 | 31 | 7.5 | 8 | -0.5 | 0.25 |

2 | 29 | 32 | 9 | 6.5 | 2.5 | 6.25 |

3 | 30 | 29 | 7.5 | 9 | -1.5 | 2.25 |

4 | 47 | 46 | 2 | 1.5 | 0.5 | 0.25 |

5 | 45 | 43 | 4 | 4 | 0 | 0 |

6 | 36 | 32 | 6 | 6.5 | -0.5 | 0.25 |

7 | 47 | 46 | 2 | 1.5 | 0.5 | 0.25 |

8 | 37 | 34 | 5 | 5 | 0 | 0 |

9 | 25 | 26 | 10 | 10 | 0 | 0 |

10 | 47 | 45 | 2 | 3 | -1 | 1 |

Total | 10.5 |

The Spearman’s Rank correlation coefficient between the ranks of $x$ and $y$ is

```
$$
\begin{aligned}
\varrho &= 1- \frac{6 \sum_{i=1}^{n}d_i^2}{n(n^2-1)}\\
&= 1-\frac{6 \times 10.5}{10(10^2-1)}\\
&= 1-\frac{63}{990}\\
&= 1- 0.0636364\\
&= 0.9894
\end{aligned}
$$
```

The correlation coefficient between **scores by Judge A** and **scores by Judge B** is $0.9894$. Since the value of correlation coefficient is positive, there is a strong positive relationship between scores by Judge A and scores by Judge B.