dopecalc

Correlation Calculator

Calculate the Pearson correlation coefficient (r) between two variables X and Y. Enter paired data points to measure the strength and direction of the linear relationship.

Enter comma or space separated values. X and Y must have the same number of values.

About this Calculator

Calculate the Pearson correlation coefficient (r) between two variables X and Y. Enter paired data points to measure the strength and direction of the linear relationship.

Formula & Calculations

Formula

r = Σ((x−x̄)(y−ȳ)) / √(Σ(x−x̄)² × Σ(y−ȳ)²); r² = coefficient of determination
Where:
  • x, y=Paired data points for variables X and Y
  • x̄, ȳ=Means of X and Y respectively
  • r=Pearson correlation coefficient (−1 to +1)
  • =Coefficient of determination (proportion of variance explained)

Assumptions

  • Both variables are continuous (interval or ratio scale).
  • The relationship between X and Y is approximately linear.
  • Data pairs are independent of each other.
  • r = +1 indicates perfect positive correlation; r = −1 indicates perfect negative correlation; r = 0 indicates no linear correlation.

Calculation Examples

Example 1

Inputs:X: [1, 2, 3, 4, 5], Y: [2, 4, 6, 8, 10]
Result:r = 1.000, r² = 1.000 (Perfect Positive)

Y is exactly 2X for all values, resulting in a perfect positive correlation.

Example 2

Inputs:X: [1, 2, 3, 4, 5], Y: [10, 8, 6, 4, 2]
Result:r = −1.000, r² = 1.000 (Perfect Negative)

Y decreases exactly as X increases, resulting in a perfect negative correlation.

Frequently Asked Questions

What does the correlation coefficient r actually tell me?

Pearson's r measures both the direction and strength of the linear relationship between two variables. Values near +1 indicate a strong positive relationship (as X increases, Y increases). Values near −1 indicate a strong negative relationship (as X increases, Y decreases). Values near 0 suggest little to no linear relationship.

Does correlation imply causation?

No. Correlation measures association, not causation. Two variables may be strongly correlated because one causes the other, both are affected by a third variable (confounding factor), or the relationship is coincidental. Always consider study design and potential confounders before inferring causation.