Skip to content

Correlation and regression

Pearson or Spearman with a confidence interval on r, plus a fitted line.

The file is not uploaded.
Method

Pearson — assumes a straight-line relationship and roughly normal data.

Paste at least three paired values into each column.

Formular = Σ(x−x̄)(y−ȳ) ÷ √(Σ(x−x̄)²Σ(y−ȳ)²); CI via atanh(r) ± z·(n−3)^−½
ModelPearson
  • Fisher’s z transformation for intervals on rMetron, 1921

Plot the data before trusting any of this. Anscombe’s quartet is four datasets with identical correlation coefficients and entirely different shapes.

When to use this

Use this to measure how strongly two variables move together, and to fit a line if that is what you need. Pearson measures a linear relationship; Spearman measures a monotonic one and is the right choice when the relationship is curved or the data have outliers.

Worked example

Protein concentration against absorbance across a standard curve.

Method
Pearson
Pairs
8

Result

r with its confidence interval, plus slope and intercept

A high r says the points lie near a line. It says nothing about whether the slope is the one you expected.

What people get wrong

  • Reading correlation as causation, or as agreement. Two methods can correlate almost perfectly and still disagree by a constant factor.
  • Using Pearson on a curved relationship. It measures linear association only, and will understate a strong non-linear one.
  • Quoting r without n. The same r means quite different things at 5 points and at 500.

Questions

+Pearson or Spearman?

Pearson if you expect a straight line and the data are roughly normal. Spearman if the relationship is monotonic but curved, or if outliers would dominate.

+Does a high r² mean a good calibration?

Not on its own. Check the residuals for structure and the slope for the value you expected; r² is easy to inflate by spreading the standards further apart.

+Can I use this for method comparison?

Correlation is the wrong tool for agreement. Use a Bland–Altman plot, which shows bias and limits of agreement rather than association.

Related tools

  • t-test calculatorCompare two groups and get the effect size and interval, not just a p-value.
  • One-way ANOVACompare three or more groups, with variance explained and every pair tested.

Science last reviewed .