Spearman's correlation coefficient

Calculates Spearman's rank correlation coefficient

This calculator below calculates Spearman's rank correlation coefficient between two random variables. The theoretical part is traditional 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

The method of Spearman's rank correlation coefficient calculation is actually pretty simple. It's like the Pearson correlation coefficient, but designed not for measurements of random variables only but for their ranking values.

That is

We have only to understand what is the rank value and why all this is necessary.

If the elements of a variational series arranged in ascending or descending order, that rank of the element will be his number in ordered series.

For example, we have a variational series {17,26,5,14,21}. Let's sort it's elements in a descending order {26,21,17,14,5}. 26 has a rank of 1, 21 - rank of 2 and so on, Variational series of ranking values will look like this {3,1,5,4,2}.

I.e. when calculating Spearman's coefficient initial variation series are converted into variational series of ranking values and then Pearson's formula is applied to them.
There is one subtlety - the rank of the repeating values is taken as the average of the ranks. That is, for a series {17, 15, 14, 15}ranking series will look like {1, 2.5, 4, 2.5}, as the first element is 15 has a rank of 2, and the second - rank of 3, and\frac{2+3}{2}=2.5.

If you don't have the repeating values, that is, all the values of ranking series - the numbers between 1 and n, the Pearson's formula can be simplified to
By the way, this formula is often given as the formula for calculating the Spearman's coefficient.

What is the essence of the transition from the values themselves to their rank value?
When investigating the correlation of ranking values you can find how well the dependence of the two variables is described by a monotonic function.

The sign of the coefficient indicates the direction of the relationship between variables. If the sign is positive the values of Y has a tendency to increase with the increasement of X. If the sign is negative the values of Y has a tendency to decrease with the increasement of X. If the coefficient is 0 there is no tendency then. If the coefficient equals 1 or -1, the relationship between X and Y has an appearance of monotonic function, i.e. with the increasement of X, Y also increases and vice versa.

That is, unlike the Pearson's correlation coefficient, which can detect only the linear relationship of one variable from another, Spearman's correlation coefficient can detect monotonic dependence, where the direct linear relationship cannot be revealed.

Here's an example.
Поясню на примере. Let's suppose,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 this data, Pearson correlation coefficient is equal to -0.4686, i.e. the relationship is weak or absent. And Spearman's correlation coefficient is strictly equal to -1, as if it's hints to the researcher that Y has strongly negative monotonic dependence from X.

URL copied to clipboard
Creative Commons Attribution/Share-Alike License 3.0 (Unported) PLANETCALC, Spearman's correlation coefficient