Correlation Coefficient Calculator
Calculate the Pearson correlation coefficient (r) between two lists of numbers.
How to use this tool
- Enter x values (comma-separated) and y values (comma-separated) in the fields above.
- Results update instantly as you type — or click Calculate.
- Read your correlation (r) and the full breakdown beneath it.
Calculate Pearson's r: a value from −1 to +1 measuring the linear relationship between two variables.
Formula
Pearson r: r = Σ((xᵢ − x̄)(yᵢ − ȳ)) / √[ Σ(xᵢ − x̄)² × Σ(yᵢ − ȳ)² ]
Where x̄ and ȳ are the means of the X and Y datasets respectively.
How it works
This calculator computes the Pearson correlation coefficient, a measure of the linear association between two numeric variables ranging from −1 (perfect negative) to +1 (perfect positive), with 0 indicating no linear relationship.
It uses the mean-deviation form of the formula, computing paired deviations from each variable's mean. The result is valid only for linear relationships; non-linear associations may show a low r even when a strong pattern exists.
Worked example
Worked example
- Inputs: X = [1, 2, 3, 4, 5], Y = [2, 4, 5, 4, 5].
- Means: x̄ = 3, ȳ = 4.
- Deviations and products: (−2)(−2)=4, (−1)(0)=0, (0)(1)=0, (1)(0)=0, (2)(1)=2. Sum = 6.
- Sum of squared X-deviations: 4+1+0+1+4 = 10. Sum of squared Y-deviations: 4+0+1+0+1 = 6.
- r = 6 / √(10 × 6) = 6 / √60 = 6 / 7.746 ≈ 0.7746.
Correlation coefficient r = 0.7746
Key terms
- Pearson correlation coefficient (r)
- A dimensionless statistic measuring the strength and direction of the linear relationship between two variables, bounded between −1 and +1.
- Covariance
- The numerator term Σ(xᵢ − x̄)(yᵢ − ȳ); measures how much two variables change together, before normalising by their standard deviations.
- Linear association
- A relationship where changes in one variable correspond proportionally to changes in another, forming a straight line when plotted.
- Correlation vs. causation
- A high r shows that two variables move together but does not imply that one causes the other; confounding factors may drive both.
- Coefficient of determination (r²)
- The square of r; represents the proportion of variance in one variable explained by the linear relationship with the other.
Frequently asked questions
- What does the correlation coefficient tell you?
- r = +1 is a perfect positive linear relationship; r = −1 is perfect negative; r = 0 means no linear correlation. Values above 0.7 or below −0.7 are generally considered strong correlations.