What Is Linear Correlation Coefficient?
The linear correlation coefficient r measures how closely paired data follow a straight line. It runs from −1 for a perfect downward line, through 0 for no linear trend, to +1 for a perfect upward line.
Paste your x and y values in matching order. The calculator returns r and r², the t statistic and two-tailed p-value, a Fisher z confidence interval for the true correlation and the Spearman rank correlation as a cross-check.
A scatter plot with the line of best fit is shown, because r alone cannot reveal curves or outliers.
How to Use the Linear Correlation Coefficient Calculator
- Paste the x values.
- Paste the y values in the same order.
- Read r, r², the p-value and the interval.
- Check the scatter plot for curves and outliers.
Linear Correlation Coefficient Formula
Pearson r
Test statistic
Linear Correlation Coefficient Variables Explained
| Symbol | Meaning | Notes |
|---|---|---|
| r | Sample correlation coefficient | |
| r² | Share of variance explained | |
| ρ | Population correlation | |
| n | Number of pairs |
Linear Correlation Coefficient Worked Example
For x = 1 to 8 and y = 2.3, 4.1, 5.8, 8.4, 9.7, 12.5, 13.6, 16.2, the points rise almost on a straight line. The calculator gives r = 0.998, so r² = 0.995: about 99.5% of the variation in y is explained by the straight-line relationship with x.
With the example values loaded in the calculator above, the steps are:
- Means: x̄ = 4.5, ȳ = 9.075.
- Sxy = Σ(x − x̄)(y − ȳ) = 83.1, Sxx = 42, Syy = 165.195.
- r = Sxy ÷ √(Sxx × Syy) = 83.1 ÷ √(42 × 165.195) = 0.997649.
- t = r √(n − 2) ÷ √(1 − r²) = 35.662 with 6 degrees of freedom, giving a two-tailed p-value of 3.2414 × 10^-8.
- The confidence interval applies Fisher’s z-transform: z′ = arctanh(r), standard error 1 ÷ √(n − 3), then back-transform with tanh.
Result: Pearson correlation r = 0.997649.
How to Read a Correlation Coefficient
The sign of r gives the direction and its size gives the strength of a straight-line relationship. For x = 1 to 8 and y = 2.3 to 16.2, r = 0.998 and r² = 0.995, so about 99.5% of the variation in y is explained by the line.
The p-value tests whether the true correlation could be zero. The confidence interval for ρ shows how precisely r is estimated, and it is wide for small samples. If the Spearman value is close to r, the relationship does not depend on the exact numerical spacing of the data.
Where Linear Correlation Coefficient Is Used
Reporting r
State r with its p-value and a confidence interval.
Checking linearity
Compare Pearson and Spearman and look at the scatter plot.
Business and science
Test whether two measures move together.
Homework
Verify r by hand from the sums.
Common Linear Correlation Coefficient Mistakes to Avoid
- Always look at the scatter plot. A curve can have r near 0.
- Correlation does not show cause.
- One outlier can change r a lot.
- With under 10 pairs, treat r as rough.
Linear Correlation Coefficient Terms and Definitions
- ρ
- The population correlation that the sample r estimates.
Linear Correlation Coefficient FAQs
How do you calculate the linear correlation coefficient?
Divide the sum of cross-products of deviations by the square root of the product of the two sums of squared deviations.
What is a good correlation coefficient?
It depends on the field. As a rough guide, the size is weak below 0.4, moderate from 0.4 to 0.7 and strong above 0.7.
What is the difference between r and r²?
r gives direction and strength. r² is the proportion of variance in y accounted for by the line.
When should I use Spearman instead of Pearson?
Use Spearman for ranked data, clear outliers, or a relationship that is steadily rising or falling but not straight.