How this calculator works
Each variable is ranked separately from smallest to largest. A tied group receives the average of the positions it occupies. Pearson correlation is then calculated on the two rank lists, which handles ties directly. The familiar shortcut based on squared rank differences is valid only without ties, so the displayed squared-difference total is a working quantity rather than the general formula used here. A constant variable has undefined rank correlation.
Formula
rho = Pearson(rank(x), rank(y)), using average ranks for ties. With no ties only: rho = 1 - 6Σd_i²/(n(n² - 1)).
Worked example
For x = 1, 2, 2 and y = 1, 1, 2, the ranks are 1, 2.5, 2.5 and 1.5, 1.5, 3. Their Pearson correlation is 0.5.
Advertisement
Frequently asked questions
Does Spearman require a straight line?
No. A consistent increasing or decreasing ordering can have strong Spearman correlation even when the raw relationship is curved.
Can I enter ranks I already calculated?
Yes, provided they describe matching pairs. Average-rank ties will be handled consistently when the values are ranked again.
Is a p-value included?
No. Inference with small samples and ties needs a specified test or permutation procedure. This tool reports the descriptive coefficient and its ranks.