Return to GeoGebra Applets

Least Squares Regression

Move the "size" slider to select a new sample size.
Move the "seed" slider to select a new set of data.
Move points A and B to reposition the blue line.
Your goal is to make the sum of the areas for the
squares shown as small as possible.
WARNING: Keep point A to the left of point B.
Click on the check boxes if you want to see the
regression line and the corresponding sum of
squares for the regression line.

This is a Java Applet created using GeoGebra from www.geogebra.org - it looks like you don't have Java installed, please go to www.java.com

The regression line minimizes the sum of the squares
of the differences between the y-values of each data point
and the corresponding y-yalues of the line shown.
These squared differences are represented by the
squares shown on the graph. Minimizing the total area
of all these squares will produce the least squares area
and the resulting line will be the regression line.

Updated November 13, 2013.

Created by David Gurney using GeoGebra