You are on page 1of 18

LEAST SQUARE METHOD

LEAST SQUARE METHOD

is a form of mathematical regression analysis that finds the line of


best fit for a dataset, providing a visual demonstration of the
relationship between the data points.
provides the overall rationale for the placement of the line of best
fit among the data points being studied. The most common
application of the least squares method, referred to as linear or
ordinary, aims to create a straight line that minimizes the sum of the
squares of the errors generated by the results of the associated
equations.
Example of a Least Square Graph
Formula for Least Square

The least squares regression line for


{(x1,y1),(x2,y2),.,(xn,yn)} is given by f(x) = ax + b,
where,

a= and b=
Example Problem
Find the least square regression line for the points (-3, 0),
(-1, 1), (0, 2), and (2, 3)
The table shows the calculations involved in finding the
least square line using n = 4.
x y xy x2
-3 0 0 9
-1 1 -1 1
0 2 0 0
2 3 6 4

= 2 = 6 = 5 2 = 14
=1 =1 =1 =1
x y xy x2
-3 0 0 9
-1 1 -1 1
0 2 0 0
2 3 6 4

= 2 = 6 = 5 2 = 14
=1 =1 =1 =1

We will find the slope and y intercept using the


formula for a and b,

a= and b=
Since we arrange the data, we can now substitute it to the
variables in the formula.
And through direct substitution we get,

a= b =

4 5 2 (6) 1 8
= = [(6 2 ]
4 14 2 2 4 13

8 47
= =
13 26
Now we have the value of a and b, we can now get the
equation for the least square regression line from the
formula f(x) = ax + b,

8 47
The value of a = and the value of b =
13 26

Now, we get the equation by substituting the values of a


and b,
8 47
f(x) = x+ 3 8 47
f(x) = 13 x + 26
13 26
2
1

-3 -2 -1 1 2 3
2. The sales of a company (in million dollars) for each
year are shown in the table below.

x
2005 2006 2007 2008 2009
(year)

y
12 19 29 37 45
(sales)
a) Find the least square regression line y = ax + b.

b) Use the least squares regression line as a model to


estimate the sales of the company in 2012.
We now use the table to calculate a and b included in the least regression line
formula.
x y xy x2

0 12 0 0
1 19 19 1
2 29 58 4
3 37 111 9
4 45 180 16

x = 10 y xy x 2
=1 =1 =1 =1
= 142 = 368 = 30
a) Find the least square regression line y = ax + b.
-We now calculate a and b using the least
square regression formulas for a and b.
n
=1 xy=1 x (=1 y) 1
a= b= (=1 y =1 x)
n =1 x 2 (
=1 x)
2

5 368 10(142) 1
a= b= (142 8.4(10))
5 30 (10)2 5
42 58
a= =8.4 b= =11.6
5 5
Sum of the Squared Errors
Sum of the Squared Errors

Is the sum of the squared differences between each observation


and its group's mean. It can be used as a measure of variation
within a cluster. If all cases within a cluster are identical the SSE
would then be equal to 0.
We can get the sum of the square errors by the formula:

S=
=1[() yi] 2
Since we know how to get the least square regression line. We
can now get the estimated sum of the squared errors.
S==1[() yi] 2

We know that f(xi) is also equal to (axi + b).

Therefore we can get the formula:

S= =1[ + b yi] 2

Let us get the sum of the squared errors from this table.
Since we get the values of a and b earlier which is :

a = 8.4 and b = 11.6


x y xy x2

0 12 0 0
1 19 19 1
2 29 58 4
3 37 111 9
4 45 180 16

x = 10 y xy x 2
=1 =1 =1 =1
= 142 = 368 = 30
Applying the formula,

S= =1[ + b yi] 2
We get:

S = [(8.4)(0) +11.6 - 12]2 + [(8.4)(1) + 11.6 - 19]2 +[(8.4)(2) + 11.6


- 29]2 + [(8.4)(3) + 11.6 - 37]2 + [(8.4)(4) + 11.6 - 45]2

= 0.16 + 1 + 0.36 + 0.04 + 0.04


= 1.6

Therefore the sum of the squared errors is 1.6


THANK YOU!
Leader:
Ayson, Zabdiel Jan
Members:
Abo, Kent Denielle
Amba, Jonna Anne Denisse
Lagrada, Joey

You might also like