Skip to content

Does one measurement predict the other?

Test whether two variables are related

Correlation, linear regression, and the difference between them.

Correlation asks whether two variables move together and treats them symmetrically. Regression asks how much one changes per unit of the other, and assumes you know which is the predictor. If you cannot say which variable causes which, you want correlation.

Pearson’s r assumes a linear relationship and reasonably normal data; Spearman’s rho works on ranks and handles curves and outliers. Always plot the data first — Anscombe’s quartet is four datasets with identical correlation coefficients and entirely different shapes.

R² describes how well the line fits the data you have. It says nothing about whether the relationship is causal, and nothing about whether it holds outside the range you measured.

What to use

If you script

Command-line and library options. No page here — they need an environment rather than a browser.

Drafted from the literature and not yet reviewed by a specialist. Treat it as a starting point, and tell us if something here is wrong. Last touched .

All tasks →