Spearman's Rank Correlation Coefficient Calculator

Input

    



Output

Correlation 0.75563
p-value 0.01148

What is the Spearman's Rank Correlation Coefficient?


When you assume the population behind the sample is not normally distributed, you use a non parametric test. The Spearman's Rank correlation is a non parametric test used to calculate the rank correlation between two variables.

To find the rank correlation you first rank all the observations in X and then you rank all the observations in Y. Assign any tied values the average of the ranks they would have received had they not been tied.

The second step is to take the difference between the ranks of X and Y and square them (Di^2). Then you sum all the Di^2 values.

The third step is to use the following formula to find the rank correlation (Rs):
\[R_s = 1 - \frac{6\times\sum d_i^2}{n(n^2-1)}\]
To test if Rs is significant you use a Spearman's rank correlation table.

Example, Bob just started a company and he wants to test if the education level of the employees have a correlation with the difficulty of their tasks. He collects the follow data on all 10 employees:
Education level is coded from 1-4 and task difficulty is coded 1-5.

Employee Education level Tasks Di^2
1 4, rank = 1.5 5, rank = 1.5 0
2 3, rank = 4 4, rank = 4 0
3 2, rank = 6.5 3, rank = 6 0.25
4 1, rank = 9 2, rank = 8 1
5 1, rank = 9 1, rank = 10 1
6 3, rank = 4 5, rank = 1.5 6.25
7 2, rank = 6.5 4, rank = 4 6.25
8 1, rank = 9 2, rank = 8 1
9 3, rank = 4 2, rank = 8 16
10 4, rank = 1.5 4, rank = 4 6.25
Total 38


\[R_s = 1 - \frac{6\times 38}{10(10^2-1)} = 0.77\]
The test hypothesis are:
H0: Rs = 0
H1: Rs > 0

Since the rank correlation is 0.77 with p-value 0.01 the null hypothesis can be rejected. Education level indeed has a correlation with task difficulty.