A residual is the vertical miss between a shown value and a fitted value. Squared error turns those misses into one exact quantity to minimize.

highlighted = computed this step

Candidate line A

For line A, y=1 plus 1x. Each residual is computed as actual y minus fitted y.

r=y(1+1x)r=y-(1+{}1x)
Two candidate lines by SSEPredictions, residuals, squared residuals, and SSE are derived from the same exact data.Two candidate lines by SSEABCDxyexact SSE certificateline A y=1+1xpred(1,2,3,4)r(0,1,-1,1)r^2(0,1,1,1)SSE3line B y=11/10+11/10xpred(11/10,11/5,33/10,22/5)r(-1/10,4/5,-13/10,3/5)r^2(1/100,16/25,169/100,9/25)SSE27/10lower SSE: line B

Why squared error

Squaring makes every miss positive and gives larger misses more weight. The trial residuals are 0, 1, -1, and 1; the table also derives a second candidate from the same data.

SSE=3SSE=3
Two candidate lines by SSEPredictions, residuals, squared residuals, and SSE are derived from the same exact data.Two candidate lines by SSEABCDxyexact SSE certificateline A y=1+1xpred(1,2,3,4)r(0,1,-1,1)r^2(0,1,1,1)SSE3line B y=11/10+11/10xpred(11/10,11/5,33/10,22/5)r(-1/10,4/5,-13/10,3/5)r^2(1/100,16/25,169/100,9/25)SSE27/10lower SSE: line B

Summary

Line A has residual sum 1 and SSE 3. Line B has smaller SSE 27/10; later lessons show how least squares chooses it.

SSEA=3,SSEB=27/10SSE_A=3,\quad SSE_B=27/10
Two candidate lines by SSEPredictions, residuals, squared residuals, and SSE are derived from the same exact data.Two candidate lines by SSEABCDxyexact SSE certificateline A y=1+1xpred(1,2,3,4)r(0,1,-1,1)r^2(0,1,1,1)SSE3line B y=11/10+11/10xpred(11/10,11/5,33/10,22/5)r(-1/10,4/5,-13/10,3/5)r^2(1/100,16/25,169/100,9/25)SSE27/10lower SSE: line B