Spearman Rank Correlation Calculator Formula

Understand the math behind the spearman rank correlation calculator. Each variable explained with a worked example.

Formulas Used

Spearman rho

rho = 1 - (6 * sum_d2) / (n * (pow(n, 2) - 1))

Variables

VariableDescriptionDefault
nNumber of Pairs10
sum_d2Sum of d squared20

How It Works

Spearman Rank Correlation

rho = 1 - 6*Sum(d^2)/[n(n^2-1)]

Measures monotonic relationship between ranked variables.

Worked Example

10 pairs, Sum d^2=20.

n = 10sum_d2 = 20
  1. 01rho = 1 - 120/990 = 0.8788