Least-Squares Line

Pronunciation: /list skwɛɚz laɪn/ Explain

A least-square line is a line that minimizes the distance between the data points it represents and the line itself. Manipulative 1 is an example of a least squares line fitted to data.

Click on the blue points and drag them to change the figure.

Move the points to create a near-vertical line. Move the points to create a near-horizontal line.
Manipulative 1 - Least Squares Line Created with GeoGebra.

How to Calculate a Least Squares Line

In the equations, N is the number of points. x is the x-coordinate of a point. y is the y-coordinate of a point. All calculated amounts are approximate.

Legendxyx2xy
A0.31.80.090.54
B0.82.20.641.76
C1.92.63.614.94
D2.22.14.844.62
E3.32.910.899.57
F3.92.515.219.75
Sum12.414.135.2831.18

m=(n*sum(xy)-sum(x)*sum(y))/(n*sum(x squared)-(sum(x) squared)) = (6*31.18-12.4*14.1)/(5*35.28)-12.4 squared)=(187.08-174.84)/(176.4-153.76)=12.24/22.64=0.54
b=(sum(y)-msum(x))/n=(14.1-0.54*12.4)/6=(14.1-6.696)/6=7.404/6=1.234
y=mx + b implies y=0.54x + 1.234

Cite this article as:

McAdams, David E. Least-Squares Line. 8/31/2018. All Math Words Encyclopedia. Life is a Story Problem LLC. http://www.allmathwords.org/en/l/leastsquareline.html.

Image Credits

Revision History

8/31/2018: Removed broken links, updated license, implemented new markup, implemented new Geogebra protocol. (McAdams, David E.)
7/18/2018: Changed title to common format. (McAdams, David E.)
7/12/2007: Initial version. (McAdams, David E.)

All Math Words Encyclopedia is a service of Life is a Story Problem LLC.
Copyright © 2018 Life is a Story Problem LLC. All rights reserved.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License