Spearman’s rank correlation coefficient, also known as Spearman’s rho, is a non-parametric measure of the strength and direction of association between two variables. It ranges from -1 to 1, where -1 indicates a perfect negative correlation, 0 indicates no correlation, and 1 indicates a perfect positive correlation.

Also Read: What is Pearson Correlation?

The Spearman correlation coefficient is calculated by determining the rank of each value for each variable, and then finding the difference between the ranks. The coefficient is then calculated by finding the correlation between the ranks of the two variables.

For example, let’s say we have two variables, X and Y, with the following values:

X: [4, 5, 6, 7, 8] Y: [3, 4, 5, 6, 7]

We would first determine the rank of each value for each variable:

X: [2, 3, 4, 5, 6] Y: [1, 2, 3, 4, 5]

Next, we find the difference between the ranks for each value:

d = [1, 1, 1, 1, 1]

Finally, we square the differences and sum them:

d^2 = [1, 1, 1, 1, 1] d^2 = 5

The correlation coefficient is then calculated as:

rho = 1 – (6 * d^2) / (n * (n^2 – 1)) rho = 1 – (6 * 5) / (5 * (5^2 – 1)) rho = 1 – 0.2 = 0.8

So in this example, the Spearman’s rho correlation coefficient is 0.8, indicating a strong positive correlation between the two variables.