Topics
Calculating Spearman's rank correlation coefficient by ranking x and y values, then using Pearson's r.
Want a deeper conceptual understanding? Try our interactive lesson!
Spearman's rank correlation coefficient tells you how well two variables line up in terms of order instead of actual values. It answers the question "When x is larger, does y also tend to be larger?". It compares data relatively, and measures whether the data is consistently sloping up.
Its value is between −1 and 1, with negative values for data that generally slopes down, and positive values when data generally slopes up.
Weak positive Spearman correlation - the data zigzags and the slope of each segment changes.
Perfect negative spearman correlation (−1) - every segment is sloping down.
To calculate it, we first convert our data values into ranks, which just means the 1st smallest, 2nd smallest etc. Then, we calculate the regular Pearson r for the correlation between these ranks:
There are 4 values for x. In order, they are:
20
30
50
100
The order for y is
20
400
400
1000
Since 400 appears at both positions 2 and 3, we say that each of them are tied for rank 2.5.
Now we update the table with the ranks:
Now we enter the ranks into our calculators, and use linear regression to find r≈0.949. This is the Spearman rank correlation coefficient for this data.
Nice work completing Spearman's Rank Correlation Coefficient, here's a quick recap of what we covered:
Exercises checked off
Calculating Spearman's rank correlation coefficient by ranking x and y values, then using Pearson's r.
Want a deeper conceptual understanding? Try our interactive lesson!
Spearman's rank correlation coefficient tells you how well two variables line up in terms of order instead of actual values. It answers the question "When x is larger, does y also tend to be larger?". It compares data relatively, and measures whether the data is consistently sloping up.
Its value is between −1 and 1, with negative values for data that generally slopes down, and positive values when data generally slopes up.
Weak positive Spearman correlation - the data zigzags and the slope of each segment changes.
Perfect negative spearman correlation (−1) - every segment is sloping down.
To calculate it, we first convert our data values into ranks, which just means the 1st smallest, 2nd smallest etc. Then, we calculate the regular Pearson r for the correlation between these ranks:
There are 4 values for x. In order, they are:
20
30
50
100
The order for y is
20
400
400
1000
Since 400 appears at both positions 2 and 3, we say that each of them are tied for rank 2.5.
Now we update the table with the ranks:
Now we enter the ranks into our calculators, and use linear regression to find r≈0.949. This is the Spearman rank correlation coefficient for this data.
Nice work completing Spearman's Rank Correlation Coefficient, here's a quick recap of what we covered:
Exercises checked off