Math & statistics

Residual & Regression Calculator

Paste paired data to get the least-squares line ŷ = a + bx, the correlation r and r², and a residual for every point — the same output as LinReg on a TI-84, with the work shown.

Least-squares line

xy observedŷ predictedresidual

Frequently asked questions

What is a residual?
Residual = observed y − predicted ŷ. It measures how far a point sits above (+) or below (−) the regression line. Residuals near zero mean the line fits that point well.
How do I find the least-squares regression line?
Slope b = Σ(x−x̄)(y−ȳ) ÷ Σ(x−x̄)², intercept a = ȳ − b·x̄, giving ŷ = a + bx. This is exactly what LinReg(ax+b) computes on a TI-84 — and what this calculator shows step by step.
What does r tell me?
The correlation coefficient r (−1 to 1) measures the strength and direction of a linear relationship. r² is the fraction of variation in y explained by the line — r = 0.9 means r² = 0.81, so 81% explained.
Why should residuals look random?
If a residual plot shows a curve or fan shape, a straight line is the wrong model — the pattern means something systematic is left over. Random scatter around zero is the sign that a linear fit is appropriate.
Do the residuals always sum to zero?
Yes — for a least-squares line with an intercept, the residuals sum to exactly zero (up to rounding). It is a useful arithmetic check on homework.

Method: ordinary least squares — b = Σ(x−x̄)(y−ȳ)/Σ(x−x̄)², a = ȳ − b·x̄; r is the Pearson correlation. Matches TI-84 LinReg(ax+b). Needs at least 3 pairs and non-constant x.