Correlation Calculator

Calculate the Pearson correlation coefficient (r), r squared, Spearman rank correlation, the regression line, covariance and the p-value from paired X and Y data. Example: X = 1, 2, 3, 4, 5 and Y = 2, 4, 5, 4, 5 gives r = 0.775, r squared = 0.6 and the line y = 2.2 + 0.6x.

FreeNo sign-up

How to use the Correlation Calculator

  1. Enter your X values and the matching Y values, one for each pair.
  2. Press Calculate to get r, r squared, Spearman, the regression line and the p-value.

Formula and method

Pearson r = covariance(X, Y) / (sd X x sd Y). Slope b = Sxy / Sxx, intercept a = mean Y – b x mean X. The test statistic t = r sqrt(n – 2) / sqrt(1 – r^2) with n – 2 degrees of freedom gives the p-value. Spearman is Pearson computed on the ranks.

Worked example

Quantity Value
X 1, 2, 3, 4, 5
Y 2, 4, 5, 4, 5
Mean X, mean Y 3, 4
Sxy, Sxx, Syy 6, 10, 6
r = 6 / sqrt(10 x 6) 0.7746
r squared 0.6
Slope, intercept 0.6, 2.2

How strong is the correlation?

|r| Strength
0.9 to 1.0 Very strong
0.7 to 0.9 Strong
0.5 to 0.7 Moderate
0.3 to 0.5 Weak
Below 0.3 Very weak or none

Pearson versus Spearman

Pearson r detects straight-line relationships in the raw values. Spearman rho ranks the data first, so it captures any consistently rising or falling pattern and resists outliers.

Correlation is not causation

Ice cream sales and drownings both rise in summer, but one does not cause the other. A third factor, such as temperature, can drive both.

Frequently asked questions

What is the correlation coefficient?

A number from -1 to 1 measuring the strength and direction of a linear relationship.

What does r squared mean?

The share of the variation in Y that a straight line on X explains.

What is a good correlation?

It depends on the field; above 0.7 is usually considered strong.

What is the difference between Pearson and Spearman?

Pearson uses raw values and measures linearity; Spearman uses ranks and measures monotonic trend.

Does correlation imply causation?

No.

How many pairs do I need?

At least 3 to compute, but 30 or more gives more reliable results.

Sources

Related calculators

Browse all calculators

Related to This Article

What people say about "Correlation Calculator: Pearson r, Spearman, R-Squared & p-Value"?

No one replied yet.

Leave a Reply