How to read this

The observations form one vector , and every fit lies in the plane spanned by the columns of . Least squares takes the point of the plane closest to : the orthogonal projection , with the residual at a right angle to the plane. The figure shows the three-dimensional slice through , and , with true lengths and angles.

  • Drag a data point: moves in the plane, the right angle stays.
  • Drag in the sum-of-squares map: moves in the plane, and its distance to is smallest at .
  • Look down on the plane: lands exactly on .

Data

Another fit

More settings

The intercept, the true line, layers, the numbers of .

Model

True line

The data are simulated: , , uniform on .

Layers

Coefficients of the other fit

Geometry: it is a simple projection

The data

Drag a point to move it. fitted line, residuals , , the line of . The sum of the squared red distances is .

The sum of squares

Drag to move it. contours of ; , the lowest point; .

TSS = ESS + RSS

Key numbers

Projection matrix and residual maker