Statistics · Regression

Linear Regression & Pearson Correlation Calculator

Fit a least-squares line to paired observations, calculate Pearson correlation and R², inspect residual error, and make a prediction.

Formula shown Runs locally Reviewed Aug 11, 2026
Follow us on Google
Equation guide

Paired quantitative observations fitted by ordinary least squares

Regression line

ŷ=b₀+b₁x

Slope

b₁=Σ(xᵢ−x̄)(yᵢ−ȳ)/Σ(xᵢ−x̄)²

Correlation

−1≤r≤1R²=r²
Statistics · Regression

Fit a least-squares line and measure correlation

Pearson r measures linear association, not causation. Prediction outside the observed x range is extrapolation.

Inputs and displayed decimal results use at most three decimal places. Full internal precision is retained during calculation.

ŷ=b₀+b₁x; r=cov(x,y)/(sₓsᵧ)

Enter paired observations and a value for prediction.

Using the model

Symbols, assumptions and limitations

Interpretation notes

Ordinary least squares requires at least two distinct x values. Pearson r describes linear association, not causation. Predictions outside the observed x range are extrapolations and may be unreliable.

Worked examples

See the method in practice

01

Perfect positive relation

Pairs (1,2), (2,4), and (3,6) produce ŷ=2x, r=1, and R²=1.

02

Imperfect fit

Real observations generally leave nonzero residuals, so R² describes the fraction of y variation explained by the fitted linear relation.

Questions

Frequently asked

What does r measure?

Pearson r measures the direction and strength of linear association on a scale from −1 to 1.

What does R² mean?

In simple linear regression it is the proportion of observed y variation explained by the fitted line.

Does correlation prove causation?

No. Confounding variables, selection effects, and coincidence can create correlation without a causal relationship.

Sources & review

Equations and examples are checked against the references below. Results are educational and should be independently verified for safety-critical work.

NIST/SEMATECH e-Handbook — Linear Least Squares Regression

Written by the STEM Hub editorial team · Reviewed August 11, 2026 · Review methodology