Least Square Method
Least Square Method
The least square method is the process of finding the best-fitting curve or line of best fit for a set of data points by reducing
the sum of the squares of the offsets (residual part) of the points from the curve. During the process of finding the relation
between two variables, the trend of outcomes are estimated quantitatively. This process is termed as regression analysis.
The method of curve fitting is an approach to regression analysis. This method of fitting equations which approximates the
curves to given raw data is the least squares.
It is quite obvious that the fitting of curves for a particular data set are not always unique. Thus, it is required to find a curve
having a minimal deviation from all the measured data points. This is known as the best-fitting curve and is found by using
the least-squares method.
Also, read:
ones. Also, suppose that f(x) is the fitting curve and d represents the error or deviation from each given point.
Now, we can write:
d = y − f(x )
1 1 1
d = y − f(x )
2 2 2
d = y − f(x )
3 3 3
…..
d = y – f(x )
n n n
The least-squares explain that the curve that best fits is represented by the property that the sum of squares of all the
deviations from given values must be minimum, i.e:
Solving these two normal equations we can get the required trend line equation.
Thus, we can get the line of best fit with formula y = ax + b
Solved Example
The Least Squares Model for a set of data (x , y ), (x , y ), (x , y ), …, (x , y ) passes through the point (x , y ) where x is the
1 1 2 2 3 3 n n a a a
average of the x ‘s and y is the average of the y ‘s. The below example explains how to find the equation of a straight line or
i a i
x i 8 3 2 10 11 3 6 5 6 8
y i 4 12 1 12 9 4 9 6 1 14
Use the least square method to determine the equation of line of best fit for the data. Then plot the line.
Solution:
Mean of x values = (8 + 3 + 2 + 10 + 11 + 3 + 6 + 5 + 6 + 8)/10 = 62/10 = 6.2
i
x y x2 xy
8 4 64 32
3 12 9 36
2 1 4 2
10 12 100 120
11 9 121 99
3 4 9 12
6 9 36 54
5 6 25 30
6 1 36 6
8 14 64 112
(5.5814) = 159.27990
2