The Handy Calculators logoTheHandyCalculators

Correlation Calculator

Pearson correlation coefficient r with scatter plot, regression line, and interpretation guide.

Autosave on
Pearson r
0.9641
r² (variance explained)
92.96%
Sample size (n)
10
t statistic
10.2754
Two-tailed p-value
0.00001

Fitted line: ŷ = 1.1333 + 0.9758 · x

Scatter plot with best-fit line

Pearson's r measures the strength and direction of a LINEAR relationship between two continuous variables. r runs from −1 (perfect negative line) through 0 (no linear association) to +1 (perfect positive line). This tool reports r, r², the OLS best-fit line, and a t-test for whether r differs from zero.

Reading r

|r| ≈ 0.1 — weak. |r| ≈ 0.3 — moderate. |r| ≈ 0.5 — strong. |r| ≥ 0.7 — very strong. These thresholds vary by field; physics expects much higher than social science.

Sign matters: positive r means as x grows, y tends to grow; negative r means y tends to fall.

r² (coefficient of determination) is the share of variance in y explained by a linear model on x. r = 0.7 → r² = 0.49: about half of y's variation is linearly explained by x.

Significance test

Even with no underlying relationship (ρ = 0), small samples produce nonzero r by chance.

Test statistic: t = r · √(n − 2) / √(1 − r²), with df = n − 2.

Two-tailed p-value tells you the probability of seeing |r| this large or larger under H₀: ρ = 0. Significant at α = 0.05 if p < 0.05.

For n = 30 with r = 0.4, t = 2.31 → p ≈ 0.028 (significant). For n = 10 with the same r, t = 1.23 → p ≈ 0.25 (not significant). Sample size matters enormously.

Worked example

x = (1,2,3,4,5,6,7,8,9,10), y = (2,4,5,4,5,7,8,8,10,12).

mean(x) = 5.5, mean(y) = 6.5. Σ(xi−x̄)(yi−ȳ) = 73.5. Σ(xi−x̄)² = 82.5. Σ(yi−ȳ)² = 75.

r = 73.5 / √(82.5·75) ≈ 0.934. r² ≈ 0.873 — about 87% of y's variance is explained by a linear fit on x.

OLS slope = 73.5/82.5 ≈ 0.891; intercept = 6.5 − 0.891·5.5 ≈ 1.6. Fitted line: ŷ = 1.6 + 0.89·x.

Correlation is not causation

Ice-cream sales correlate with drownings; both spike in summer (the lurking variable). r doesn't tell you which way the arrow points or whether one even exists.

Reverse causation: faster typing correlates with more typos — typing speed could cause typos, typos (frustration) could slow typing, or both depend on fatigue.

Confounders: school years and salary correlate; ability, family background, and field all confound.

Restriction of range — if you only sample the top 10% of x, r drops sharply even if the true relationship is strong.

Common pitfalls

r only catches LINEAR relationships. A perfect parabola y = x² with x spanning negative and positive gives r ≈ 0.

Outliers swing r dramatically — one extreme point can flip a weak negative to a strong positive. Always plot the scatter.

Treating r as a probability or percentage. r = 0.5 doesn't mean '50% related'; r² is the variance-explained percentage.

Computing r across heterogeneous subgroups can hide or invert the true within-group relationships (Simpson's paradox).

Frequently asked questions

Pearson vs Spearman?

Pearson assumes linearity and approximately normal residuals. Spearman uses ranks instead and captures any monotonic relationship — use it for ordinal data or when outliers dominate.

Can r be exactly 1 or −1?

Only when every data point sits exactly on a single line. In real data, expect to never see exact ±1.

How large a sample do I need?

To detect r = 0.3 at α = 0.05 with 80% power, you need about n = 84. To detect r = 0.5, about n = 30.

What if my two variables aren't both continuous?

For one continuous + one binary, use point-biserial (mathematically equivalent to two-sample t). For two binary, use the phi coefficient (mathematically equivalent to chi-square).

By Larius — software engineer, NC real estate broker & CRE/business appraiserReviewed by the Handy Calculators editorial teamHow we build calculators

More in Statistics & Probability

From z-scores and confidence intervals to t-tests, chi-square, correlation, regression, and the binomial/Poisson distributions — textbook-grade tools with worked examples.

See hub →
Browse all Education →

Free download

Property Investment Checklist (PDF)

A field-tested checklist from a licensed broker and commercial appraiser: what to verify before you tour, how to check income and expenses, and the ratios lenders actually test.

We email you the guide. No spam, unsubscribe any time.

See all free resources