Advertisement

Correlation coefficient calculator

Enter x and y observations in matching order. Choose linear association or association between their ranks.

Calculator

Use commas, spaces or new lines between numbers. Use the same unit for every observation.

Use commas, spaces or new lines between numbers. Use the same unit for every observation.

Selected correlation coefficient
0.981981
Squared coefficient
0.964286
Pair count
3.000000
Values used for correlation
Original xOriginal yAnalysis xAnalysis y
1.0000002.0000001.0000002.000000
2.0000004.0000002.0000004.000000
3.0000005.0000003.0000005.000000

Advertisement

How this calculator works

Pearson measures how consistently the original values follow a straight line. Spearman applies Pearson to average ranks and can detect monotonic patterns that are curved in the original scale. Tied observations receive their average occupied rank. Lists must have equal lengths and each variable must vary. The paired table shows exactly which original values or ranks enter the calculation.

Formula

r = Σ((x - meanX)(y - meanY))/sqrt(Σ(x - meanX)² Σ(y - meanY)²). Spearman uses ranks in place of x and y.

Worked example

For x = 1, 2, 3 and y = 2, 4, 6, Pearson r = 1. Reversing the y ranks to 3, 2, 1 gives Spearman correlation -1.

Advertisement

Frequently asked questions

Does a zero coefficient prove independence?

No. A curved or non-monotonic relationship may have zero Pearson or Spearman correlation.

What does the squared coefficient mean?

For a simple linear regression with an intercept, squared Pearson r equals R squared. Squared Spearman correlation describes ranks instead.

Can I infer causation?

No. Confounding, selection and coincidence can create an association. Inspect the context and a scatter plot.

Sources

Advertisement