Correlation Calculator
How closely two sets of numbers move together, by Pearson and by rank, with a confidence interval around the answer.
Results
What this tool does
A correlation runs from minus one to plus one. At plus one every rise in the first list comes with a proportional rise in the second; at minus one they move exactly opposite; at zero knowing one tells you nothing about the other. This page gives two versions: Pearson, which measures closeness to a straight line, and Spearman, which only asks whether they move in the same order and so survives curves and outliers. The interval around the answer matters as much as the answer: on ten points, a correlation of 0.6 has an interval wide enough to include almost nothing and almost everything.
Formula
Pearson's r = covariance ÷ (deviation of x × deviation of y) · Spearman's r = the same, applied to the ranks
Variables
| Symbol | Meaning | Unit |
|---|---|---|
x_values | The x values, one per line or separated by commas | — |
y_values | The y values, in the same order | — |
confidence | Confidence level | % |
OUT | Correlation (Pearson r) | — |
SR | By rank (Spearman) | — |
R2 | Of the variation the line explains | % |
ST | How strong | — |
DR | Which way | — |
LO | Lower end of the interval | — |
UP | Upper end of the interval | — |
CV | Covariance | — |
PV | p value (two-tailed) | — |
SG | The slope is more than noise | — |
CT | Count | — |
Worked example
- The x values, one per line or separated by commas12, 15, 11, 19, 22, 14, 17, 13, 25, 16
- The y values, in the same order18, 21, 17, 24, 29, 20, 23, 19, 31, 22
- Confidence level95 %
- Correlation (Pearson r)0.9948
- By rank (Spearman)1.0000
- Of the variation the line explains98.96 %
- How strongStrong
- Which wayThey rise together
- Lower end of the interval0.9774
- Upper end of the interval0.9988
- Covariance20.3778
- p value (two-tailed)0.000000
- The slope is more than noiseYes
- Count10
Limitations
- The calculation runs entirely in your browser. The values you type are never sent to a server.
Frequently asked questions
Does a strong correlation mean one causes the other?
No, and no amount of statistical strength changes that. Two things can move together because one causes the other, because both follow a third thing neither of you thought of, because of how the sample was collected, or by pure chance in a small dataset. A correlation of 0.95 between ice cream sales and drownings is real and tells you about summer, not about ice cream. This page measures the movement; deciding what produced it needs an argument, an experiment, or both.
When should I look at the Spearman figure instead?
When the relationship is steady in direction but not in shape, and when a few extreme values are dragging the line. Pearson measures how close the points are to a straight line and is easily pulled about by one distant point; Spearman replaces every value by its rank and asks only whether they move up together, which is immune to the shape and to the outliers. When the two figures are close, the relationship is near enough linear. When Spearman is much the larger, the relationship is real but curved.