Linear regression calculator

Paste two columns of paired data (x, y). The calculator fits the line y = m·x + b by ordinary least squares and reports slope, intercept, R² and residual sum.

Line of best fit
y = m·x + b
Slope (m)
0
Intercept (b)
0
0
Correlation (r)
0
SSE (residuals)
0
n (pairs)
0

Formulas (ordinary least squares)

  • m = Σ((xᵢ − x̄)(yᵢ − ȳ)) / Σ((xᵢ − x̄)²)
  • b = ȳ − m·x̄
  • R² = 1 − (Σ(yᵢ − ŷᵢ)² / Σ(yᵢ − ȳ)²)