Ordinary Regression and Orthogonal Regression in the Plane

Fitting a straight line to a given collection of points in the plane may be accomplished using different criteria, the most commonly used being the minimization of the sum of the squares of the vertical distances from each point to the line (ordinary regression). Another criterion is to minimize the sum of the squares of the perpendicular distances between each point and the line (orthogonal regression). Try to determine visually the lines of best fit (blue for ordinary regression, and red for orthogonal regression) by varying the respective intercepts and slopes with the sliders. For each point, the dashed blue segment joins it vertically to the blue line, while the dashed red segment connects it orthogonally to the red one. Pressing the button will yield the two lines of best fit.