Português

Spearman correlation

Association and correlation · reference distribution: t(n−2) approx.

When to use it

Measure the monotonic relationship between two variables, even if non-linear or ordinal: it is Pearson computed on ranks.

Null hypothesis

There is no monotonic association.

Assumptions

Test statistic

\rho = 1 - \dfrac{6 \sum d_i^2}{n(n^2 - 1)}

Effect size

ρ itself.

How to report it

ρ = .51, n = 30, p = .004

In R and Python

R
cor.test(x, y, method = "spearman")
Python
stats.spearmanr(x, y)

In Python, stats is scipy.stats and np is numpy.

Variants and alternatives

Where it sits in the catalog

Association and correlation. Instead of comparing groups, they measure whether two variables move together, and how strongly.

In the decision tree

  1. What do you want to do? Measure the relationship between two variables
  2. What kind of variables are they? Both numeric
  3. Is the relationship linear, without strong extreme values? No, or the variables are ordinal
  4. Is the sample small, or does it have many ties? No

Open the decision tree