Correlation Coefficient Calculator
Pearson’s r, r squared, the covariance and Spearman’s rank correlation for paired data.
Result
Pearson’s r: 0.774597
Exact arithmetic on the pairs entered. Correlation is not causation.
- r squared
- 0.6
- Direction
- Positive: y tends to rise as x rises
- Spearman’s rank correlation, ρ
- 0.737865
- Sample covariance
- 1.5
- Number of pairs
- 5
https://calcgallery.com/statistics/correlation-coefficient-calculator/
Results follow the mathematical operation and values shown. Check that you selected the intended operation, convention and dataset type before relying on the result. Read the full disclaimer
How to use the Correlation Coefficient Calculator
- Enter your pairs of values, one x and y per row. At least three pairs.
- Read Pearson's r, then r squared, the direction, Spearman's rank correlation and the covariance.
Pearson’s r
r = Σ(x − x̄)(y − ȳ) ÷ √(Σ(x − x̄)² × Σ(y − ȳ)²)
r runs from −1 to +1. Plus 1 means the points lie exactly on a rising straight line and −1 on a falling one. Zero means no straight-line relationship. That is not the same as no relationship: points on a U-shape can have r near 0.
The page works from each value’s distance to the mean, in two passes, rather than the shortcut of raw sums of products. The shortcut loses precision badly when the values are large compared with their spread. Perfect lines come out at exactly +1 and −1.
r squared
r² is the share of the variation in y that a straight line through x explains. An r of 0.77 gives an r² of 0.6: the line accounts for 60% of the variation, and the other 40% is scatter around it.
Spearman’s rank correlation
Spearman’s rho replaces each value with its rank and then calculates Pearson’s r on the ranks. Tied values share the average of the ranks they would occupy, so 10, 20, 20, 30 rank as 1, 2.5, 2.5, 4. It suits ordered categories, data with outliers, and relationships that rise or fall consistently without being straight.
Covariance
The covariance, Σ(x − x̄)(y − ȳ) ÷ (n − 1), has the same sign as r but is in the units of x times the units of y, so its size is hard to interpret on its own. Dividing it by both standard deviations gives r.
With your numbers
- x̄ = 3, ȳ = 4
- Σ(x − x̄)(y − ȳ) = 6; Σ(x − x̄)² = 10; Σ(y − ȳ)² = 6
- r = 6 ÷ √(10 × 6) = 0.774597
Quick reference
Exact arithmetic on the pairs entered. Correlation is not causation.
| Example | Pearson’s r |
|---|---|
| Five points, rising loosely | 0.774597 |
| Perfect rising line | 1 |
| Perfect falling line | -1 |
| y = x², four points | 0.984374 |
| Hours studied and score | 0.976723 |
| No relationship | 0 |
Common questions about the Correlation Coefficient Calculator
- What counts as a strong correlation?
- There is no agreed cut-off, which is why this page does not label r as weak or strong. Rules of thumb differ between fields: an r of 0.3 can matter in medicine and be negligible in physics. Look at r squared, the share of the variation in y that a straight line through x accounts for, and at the scatter plot, which shows what the single number cannot.
- What is the difference between Pearson and Spearman?
- Pearson’s r measures how closely the points follow a straight line. Spearman’s rho measures how consistently y rises or falls as x rises, whatever the shape, by correlating the ranks instead of the values. For y = x² on 1 to 4, Pearson gives 0.984 because the points curve, while Spearman gives exactly 1 because every step up in x is a step up in y.
- Does correlation mean one thing causes the other?
- No. Two variables can move together because a third drives both, because of coincidence in a small sample, or because the cause runs the other way. Ice cream sales and drownings both rise in summer. A correlation is a reason to look for a mechanism, not evidence of one.
- Why did the page refuse my data?
- If every x or every y is the same, that variable does not vary, and correlation, which measures how two variables vary together, is undefined. The page says which one has no spread rather than showing an error value.