TTKTheTextKit

Correlation Calculator

Paste two lists of numbers, one for X and one for Y, and see how strongly they move together. You get Pearson's correlation coefficient r or Spearman's rank correlation rho, r squared, the t statistic, the p-value for a two-sided or one-sided test, a confidence interval for r, the best fit line and a scatter plot. Everything runs in your browser.

Correlation r
0.81642
strong positive relationship
r squared
0.66654
66.65% of the variation
p-value
0.00217
Two-sided
t statistic
4.2415
Degrees of freedom: 9
95% interval
0.4244 to 0.9507
Fisher z interval for r
Number of pairs
11

This is a strong positive relationship. It is statistically significant at the 0.05 level: with 11 pairs, a correlation this far from zero would be unusual if the true correlation were zero.

Best fit line: y = 0.50009x + 3.0001

X (4 to 14)Y (4.26 to 10.84)

Pearson's r measures how close the points lie to a straight line, from -1 (a perfect downhill line) through 0 (no straight line relationship) to +1 (a perfect uphill line). Spearman's rho does the same on the ranks of the values, so it also picks up steady curved relationships and is not thrown off by outliers. The p-value is the chance of a correlation at least this far from zero if the true correlation were zero. A significant correlation does not show that one variable causes the other. The example is the first set of Anscombe's quartet. Everything is worked out in your browser.

Related Tools

[5 suggestions]

About the Correlation Calculator

A correlation coefficient measures how closely two variables follow a straight line, on a scale from -1 (a perfect downhill line) through 0 (no straight line relationship) to +1 (a perfect uphill line). Pearson's r is the covariance of the two lists divided by the product of their standard deviations. Spearman's rho is the same calculation applied to the ranks of the values, with tied values sharing the average of their ranks, so it detects any steadily rising or falling relationship, curved or not, and is much less affected by outliers. The p-value comes from the t statistic r times the square root of n minus 2, divided by the square root of 1 minus r squared, with n minus 2 degrees of freedom. The confidence interval uses Fisher's z transformation, the inverse hyperbolic tangent of r, which has an approximately normal spread. The calculator's example is the first set of Anscombe's quartet, eleven pairs with r = 0.8164, t = 4.2415 with 9 degrees of freedom, p = 0.00217 and a 95% interval of 0.424 to 0.951. Spearman's rho for the same data is 0.8182. The best fit line, about y = 0.5x + 3, comes from least squares. Anscombe's other three sets give almost exactly the same r with very different shapes, which is why the scatter plot matters: r summarizes a straight line relationship and says nothing about curves or outliers. A significant correlation does not show that one variable causes the other.

What is a good correlation coefficient?▾

There is no universal cutoff. As a rough guide, values from 0.7 to 0.9 are strong and above 0.9 very strong, 0.4 to 0.7 moderate, and below 0.2 very weak. What counts as good depends on the field, and the sign shows whether the relationship rises or falls.

What is the difference between Pearson and Spearman correlation?▾

Pearson's r measures a straight line relationship in the raw values. Spearman's rho works on the ranks, so it picks up any steadily rising or falling relationship and is not thrown off by outliers. Use Spearman for ranked data or curved but one directional patterns.

Does a high correlation mean one thing causes the other?▾

No. Two variables can move together because of a third factor, by coincidence, or because the cause runs the other way. Correlation shows an association, and establishing cause needs a controlled experiment or careful design.

How many pairs do I need?▾

The calculator needs at least 3 pairs, and a confidence interval needs 4. With very few pairs, a large r can easily arise by chance, which the p-value and the wide interval will show. More pairs give a much more reliable estimate.

Is my data uploaded?▾

No. The calculation runs in your browser and nothing you enter is sent anywhere.