A correlation coefficient sums up, in one number between −1 and +1, how strongly two variables move together. Values near +1 mean that high X goes with high Y, values near −1 mean that high X goes with low Y, and values near 0 mean there is no consistent pattern of that kind.
Different coefficients look for different patterns. Pearson’s r measures straight-line (linear) association and is the default for measurements. Spearman’s ρ ranks both variables first, so it captures any steadily increasing or decreasing (monotonic) relationship and is not thrown off by outliers. Kendall’s τ-b compares every pair of points and counts how often they are ordered the same way; it is preferred for small samples and many tied values. The Matthews or phi coefficient is Pearson’s r for two yes/no variables coded 0 and 1, as in a 2×2 table or a classifier’s predictions.
Next to the coefficient you get a verbal strength label, R², a significance test with its p-value, the regression line and a scatter plot, so you can see at a glance whether one number really describes the cloud of points.
How to use the Correlation Coefficient Calculator
- X values
- Y values (same order as X)
- Correlation coefficient
Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
Enter the X and Y values in the same order and choose the coefficient. Pearson works with deviations from the means; Spearman replaces each value by its rank (ties get the average rank) and correlates the ranks; Kendall counts concordant and discordant pairs; Matthews treats the data as a 2×2 table. The test uses t with n − 2 degrees of freedom (Pearson, Spearman), a normal z (Kendall) or χ² with 1 degree of freedom (phi).
Worked example
For X = 1, 2, 3, 4, 5, 6 and Y = 2.1, 3.9, 6.2, 7.8, 10.1, 12.2 the means are 3.5 and 7.05. The sum of cross-products Σ(x − x̄)(y − ȳ) is 35.35, Σ(x − x̄)² = 17.5 and Σ(y − ȳ)² = 71.535, so r = 35.35 ÷ √(17.5 × 71.535) = 0.9991 and R² = 0.9982. The test statistic t = 0.9991 × √(4 ÷ (1 − 0.9982)) = 47.24 with 4 degrees of freedom gives p < 0.0001, and the fitted line is ŷ = 2.02x − 0.02. Both Spearman's ρ and Kendall's τ equal 1 here because Y rises every time X does.
How strong is the correlation?
| |r| (absolute value) | Strength (Evans, 1996) |
|---|---|
| 0.00 to 0.19 | Very weak |
| 0.20 to 0.39 | Weak |
| 0.40 to 0.59 | Moderate |
| 0.60 to 0.79 | Strong |
| 0.80 to 1.00 | Very strong |
Formula
Pearson r = Σ(x − x̄)(y − ȳ) ÷ √(Σ(x − x̄)² · Σ(y − ȳ)²) · Spearman ρ = Pearson r of the ranks · Kendall τ-b = (C − D) ÷ √((C + D + Tx)(C + D + Ty)) · t = r√((n − 2) ÷ (1 − r²))
Worked example
Inputs: X values: 1, 2, 3, 4, 5, 6; Y values (same order as X): 2.1, 3.9, 6.2, 7.8, 10.1, 12.2; Correlation coefficient: Pearson r (linear relationship).
Results: Correlation coefficient = 0.9991; Strength and direction = Very strong positive correlation; Coefficient squared (R² for Pearson) = 0.9982; Test statistic = 47.2384; Test used = t = 47.2384 with 4 degrees of freedom; p-value (two-tailed) = < 0.0001.
Key terms
- Correlation coefficient
- A number from −1 to +1 measuring how strongly two variables are associated.
- Monotonic relationship
- One in which Y always moves in the same direction as X increases, but not necessarily along a straight line.
- Concordant pair
- Two points ordered the same way on both variables (one is higher on X and on Y).
- Coefficient of determination (R²)
- The proportion of the variance in Y explained by the linear fit.
Frequently asked questions
What is a good correlation coefficient?
It depends on the field. In physics and calibration r > 0.99 is expected; in psychology or medicine r = 0.3 can be important. On Evans' scale 0.6–0.79 is strong and 0.8 or more very strong.
Which correlation coefficient should I use?
Pearson for roughly linear, continuous data without big outliers; Spearman for ranks, skewed data or curved but steadily rising relationships; Kendall for small samples with many ties; Matthews/phi for two 0/1 variables. If you choose phi for data that are not 0/1, each variable is coded 1 above its median and 0 otherwise.
Does correlation mean causation?
No. Ice-cream sales and drownings both rise in summer because a third factor (hot weather) drives both. Correlation only shows that two variables move together.
What does a negative correlation mean?
That high values of X tend to go with low values of Y. r = −0.8 is just as strong as r = +0.8, only in the opposite direction.
How do I know if r is significant?
Convert it to t = r√((n − 2) ÷ (1 − r²)). With 10 pairs, r = 0.632 gives t = 2.31 and p = 0.05, which is the smallest r significant at the 5% level for that sample size.
Why is R² different from r?
R² = r² is the share of the variance of Y explained by the straight line. r = 0.7 means R² = 0.49, so about half the variation is explained.
Can r be 0 when there is a relationship?
Yes. Points on a U-shaped curve such as y = x² for x from −3 to 3 give r = 0, because r only detects linear trends. Always look at the scatter plot.