Linear Regression (Slope + Intercept)

y = mx + b via least squares. Returns m, b, r², SE.

Inputs

Result

Loading calculator…

How to use this calculator

  • Enter paired x, y values.

About this calculator

Linear regression via least squares: minimizes sum of squared residuals. Slope m = Σ(x−x̄)(y−ȳ) / Σ(x−x̄)². r² = % variance in y explained by x. SE of slope used to test if slope is significantly non-zero (slope/SE = t-statistic). Foundation of predictive modeling. Source: Wolfram MathWorld - Least Squares Fitting.

Frequently asked

r² interpretation?+
Fraction of y's variation explained by linear fit with x. r²=1: perfect. r²=0: no linear relationship.
When linear fails?+
Non-linear data. Plot residuals — if pattern, transform variables (log, square root) or use nonlinear regression.
Outliers?+
Heavy influence on least squares (squared residuals). Use Robust regression or remove outliers carefully.
Confidence interval for slope?+
m ± t_(α/2, n−2) × SE_slope. n=10, α=.05: ~2.31 × SE.
Multiple regression?+
y = b₀ + b₁x₁ + b₂x₂ + … Matrix algebra. Use software (Excel LINEST, Python sklearn).

Related calculators

More tools you might like

Hand-picked tools that pair well with this one — same audience, same intent.