Least Squares Criteria for the Least Squares Regression Line
The least squares regression line is commonly used as the best fitting line to a fixed collection of points. This simulation provides a visualization of the squares used in determining this line. For each of three datasets, the residuals from the points to a line are shown as dashed vertical segments. The squares of the residuals are shown with a red border. You can adjust the slope and intercept of the line in an effort to find the line for which the sum of the areas of these squared residuals is least. Click the button to obtain the least squares regression line.
This simulation runs on desktop using the free Wolfram Player. Download the Wolfram Player here.

Authors: Mariel Maughan, Bruce Torrence. Open content licensed under CC BY-NC-SA.

View the source code for this simulation