LOCAL DATA ANALYSIS

Linear regression calculator

Fit a least-squares line to paired values. Calculate slope, intercept and R², view the scatter plot and fitted line, and export your result.

Your inputs

One value per line, or use semicolons. Keep X and Y paired by row. Up to 5,000 pairs; blanks are errors, not zeros.

Calculated on this device. No AI request or data upload.

Least-squares fitted line

ŷ = 15.4 + 0.62 × X

5 paired observations. This describes the input data; it does not validate predictions or a causal effect.

211027.352033.73040.054046.450XY
Slope
0.62
Intercept
15.4
R²
0.9907216

Formula and method

ŷ = intercept + slope × X; slope = Σ[(x − mean X)(y − mean Y)] ÷ Σ(x − mean X)²

Simple linear regression fits one numeric outcome to one numeric predictor. Least squares selects the line that minimizes the sum of squared vertical residuals.

Worked example

For X = 10, 20, 30, 40, 50 and Y = 21, 29, 33, 41, 46, the fitted line is ŷ = 15.4 + 0.62 × X. R² is approximately 0.9907.

What the result can tell you

X must vary and at least two complete pairs are needed. R² describes in-sample fit and is not predictive accuracy. Constant Y gives a zero slope but makes R² undefined in this calculator. Inspect outliers and residual patterns; extrapolation beyond the input range is not validated here.

Method reference: NIST: linear least squares.

Continue with a chart