Correlation Coefficient (Pearson r) & Linear Regression Calculator

Compute Pearson's r, R-squared (R²), t-test P-value, linear regression equation (ŷ = bX + a), and an interactive SVG scatter plot locally in your browser.

Paired Dataset Inputs (X & Y) Separate values with commas, spaces, or line breaks • Or paste a 2-column table from Excel / Sheets
• •
Count(X): 10
Count(Y): 10
✓ 10 valid (X, Y) data pairs matched (n = 10 ≥ 3)
Active Sample: Study Hours (X) vs. Exam Score (Y)

Statistical Correlation & Regression Results

Pearson Correlation (r)
+0.9966
Strong Positive Correlation
Sample Covariance sxy = +36.4444
Coeff. of Determination (R²)
0.9933
99.33% of variance in Y is explained by X
Two-Tailed P-Value (H₀: ρ = 0)
< 0.00001
Significant at α = 0.05 (Reject H₀)
t = +34.4215 • df = n − 2 = 8
Linear Regression Equation (Ordinary Least Squares)
ŷ = 5.2916X + 47.4545
Slope (b): +5.2916 Y-Intercept (a): +47.4545 Std. Error (se): 1.2185
Regression Y-Predictor
→ ŷ = 79.2042
Predicted point (X, ŷ) is marked on the scatter plot below.

Scatter Plot & Line of Best Fit

Observed Pairs (n = 10) Regression Line (ŷ = bX + a) Mean Centroid (x̄, ȳ) Predicted (X, ŷ)

Summary Means, Deviations & Sums of Squares

Sample Pairs (n & df) n = 10 (df = 8)
Mean of X (x̄) & SD (sx) 5.3000 ± 2.6268
Mean of Y (ȳ) & SD (sy) 75.6000 ± 13.9459
Sum of Squares X (SSx) 62.1000
Sum of Squares Y (SSy) 1750.4000
Sum of Cross-Products (SPxy) +328.6000
ADVERTISEMENT
Responsive In-Content Banner (336 × 280 or 728 × 90)

How to Calculate and Interpret Pearson's Correlation Coefficient (r)

The Pearson product-moment correlation coefficient (r) quantifies how closely two continuous numerical variables follow a straight-line relationship. Because covariance depends on the units of measurement (such as dollars, kilograms, or hours), Pearson's formula divides the sum of cross-products (SPxy) by the geometric mean of each variable's sum of squares (SSx and SSy), producing a universal dimensionless score strictly bounded between −1.0000 and +1.0000.

1. Pearson Correlation Formula (r)

Standardized linear association between X and Y

r = SPxy √SSx · SSy = Σ(Xi − x̄)(Yi − ȳ) √Σ(Xi − x̄)² · Σ(Yi − ȳ)²

Notice that Pearson r is symmetric (r(X, Y) = r(Y, X)) and unaffected by linear unit conversions (e.g., converting Celsius to Fahrenheit leaves |r| identical).

2. Linear Regression & t-Test for r

Best-fit slope b, intercept a, and statistical significance

b = SPxy SSx ,   a = ȳ − bx̄ ,   t = r√(n − 2) √(1 − r²)

Unlike correlation, linear regression is directional: swapping X and Y changes both the slope (b) and the intercept (a) because vertical residuals in Y are minimized.

Pearson Correlation Reference Scale (−1.00 to +1.00)

Pearson r Range Strength & Direction Variance Explained (R²) Practical Interpretation & Example
+1.00 Perfect Positive 100% All points lie on an upward straight line (e.g., distance in miles vs. kilometers)
+0.70 to +0.99 Strong Positive 49% – 98% Tight upward linear trend (e.g., height vs. wingspan, hours studied vs. test score)
+0.40 to +0.69 Moderate Positive 16% – 48% Clear upward pattern with noticeable scatter (e.g., ad budget vs. monthly leads)
+0.20 to +0.39 Weak Positive 4% – 15% Slight upward tendency; other factors account for most variation in Y
−0.19 to +0.19 Negligible / No Linear 0% – 3.6% Cloud of points with no linear slope (always check scatter plot for curved U-shapes!)
−0.20 to −0.39 Weak Negative 4% – 15% Slight downward drift as X increases
−0.40 to −0.69 Moderate Negative 16% – 48% Substantial inverse trend (e.g., vehicle weight vs. city fuel efficiency)
−0.70 to −0.99 Strong Negative 49% – 98% Tight downward linear trend (e.g., altitude above sea level vs. atmospheric pressure)
−1.00 Perfect Negative 100% All points fall on an exact downward line (e.g., amount spent vs. remaining budget)

Frequently Asked Questions (FAQ)

Pearson's r tells you two things simultaneously about the linear relationship between Variable X and Variable Y: (1) Direction via its sign—positive (r > 0) means Y tends to rise as X rises, while negative (r < 0) means Y tends to fall as X rises; and (2) Strength via its closeness to ±1.00. Values near 0 mean a straight line does not capture any trend, though you should always inspect the scatter plot in case a curved (quadratic or exponential) pattern is present.
Correlation (r) ranges from −1.0 to +1.0 and preserves the sign of the slope. R-squared (R² = r²), called the Coefficient of Determination, ranges from 0 to 1 (or 0% to 100%) and measures the exact percentage of variance in Y explained by the linear regression model on X. For example, r = −0.80 indicates a strong negative correlation, while R² = (−0.80)² = 0.64 tells you that 64% of the variability in Y is accounted for by X (and 36% is due to other factors or random error).
Mathematically, evaluating degrees of freedom (df = n − 2) and a P-value requires a minimum of n = 3 paired observations (any 2 distinct points always yield a trivial straight line with r = ±1.0). However, in small samples (such as n = 4 or n = 6), a single outlier can swing r dramatically. For reliable scientific, business, or academic inference, aim for at least n = 25 to 30+ data pairs and verify statistical significance via the two-tailed t-test P-value (p < 0.05).
No—correlation never proves causation by itself. Even when r = +0.92 with p < 0.0001, three alternative explanations exist: (1) a hidden confounding variable Z drives both X and Y (e.g., hot summer weather increases both air-conditioner electricity usage and cold beverage sales), (2) reverse causality (Y actually causes X), or (3) coincidental time-series trends. Proving causation requires randomized controlled experiments or rigorous causal inference designs.
No—100% of your data stays private on your device. All Pearson correlation, linear regression, hypothesis testing, and SVG scatter plot calculations execute entirely client-side inside your web browser using vanilla JavaScript. Zero backend servers, zero databases, and zero external API calls ever touch your numbers.

Explore Our Free Calculator Series

Fast, privacy-first math & statistical utilities running 100% in your browser.

ADVERTISEMENT
Responsive Bottom Banner (728 × 90 or Auto)