Linear Regression (Slope + Intercept)

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

Inputs

Result

y = mx + b
y = 0.6000x + 2.2000
r² = 0.6000 · SE(slope) = 0.2828.
  • n5
  • Slope (m)0.600000
  • Intercept (b)2.200000
  • r (correlation)0.774597
  • r² (var explained)0.600000
  • SE of slope0.282843
  • SSE (residuals)2.4000

Step-by-step

  1. Slope m = Σ(x−x̄)(y−ȳ) / Σ(x−x̄)² = 0.6000.
  2. Intercept b = ȳ − m × x̄ = 2.2000.
  3. r² = 0.6000 (% variance explained).

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

Fraction of y's variation explained by linear fit with x. r²=1: perfect. r²=0: no linear relationship.

Related calculators