Spearman's Rank Correlation Calculator

This online calculator calculates the Spearman's rank correlation coefficient, which is a measure of the degree of association between two ranked variables.

This page exists due to the efforts of the following people:




Created: 2015-08-07 15:30:52, Last updated: 2023-04-05 02:52:10

To use the calculator, the user inputs the number pairs in two columns, representing the two variables being analyzed. The calculator then ranks each variable separately, assigns a rank to each value, and calculates the Spearman's rank correlation coefficient based on the ranks.

The Spearman's rank correlation coefficient ranges from -1 to +1, where -1 indicates a perfect negative correlation, 0 indicates no correlation, and +1 indicates a perfect positive correlation. More theory can be found below the calculator.

PLANETCALC, Spearman's correlation coefficient

Spearman's correlation coefficient

Changes of random variables

Items per page:

Digits after the decimal point: 4
Spearman's correlation coefficient

Spearman's rank correlation coefficient

The method for calculating Spearman's rank correlation coefficient is quite simple. It is similar to the Pearson correlation coefficient, but it is designed not only for measuring random variables but also for their ranking values. The formula for Spearman's coefficient is:


To understand the calculation, it's important to know what rank values are and why they are necessary. If the elements of a variational series are arranged in ascending or descending order, their rank is the element's position in the ordered series. For example, if we have a series {17,26,5,14,21}, its sorted form would be {26,21,17,14,5}, and the ranking series would be {3,1,5,4,2}.

When calculating Spearman's coefficient, the initial variation series is converted into a variation series of ranking values, and then Pearson's formula is applied to them. One subtlety to keep in mind is that repeating values' ranks are taken as the average of the ranks.

If you don't have the repeating values the formula can be simplified to
By the way, this formula is often given as the formula for calculating the Spearman's coefficient.

The transition from the values themselves to their rank value is important for investigating the correlation of ranking values and determining how well a monotonic function describes the dependence of the two variables. Unlike Pearson's correlation coefficient, which can detect only a linear relationship between variables, Spearman's correlation coefficient can detect monotonic dependence where the direct linear relationship cannot be revealed. The sign of the coefficient indicates the direction of the relationship between variables, and if the coefficient equals 1 or -1, the relationship between the variables has a monotonic function.

Here's an example. Let's suppose that we examine the function y=10/x. We have the following measurements of X and Y: {{1,10}, {5,2}, {10,1}, {20,0.5}, {100,0.1}}

For example, let's consider the function y=10/x and the measurements of X and Y: {{1,10}, {5,2}, {10,1}, {20,0.5}, {100,0.1}}. The Pearson correlation coefficient (-0.4686) indicates a weak or absent relationship, while Spearman's correlation coefficient (-1) suggests a strongly negative monotonic dependence between Y and X.

URL copied to clipboard
PLANETCALC, Spearman's Rank Correlation Calculator