0% found this document useful (0 votes)
208 views4 pages

Least Square Method

The least squares method fits an algebraic equation to data points by minimizing the sum of the squares of the residuals. It can be used for linear or nonlinear equations depending on the pattern of the data. For a linear fit, the normal equations are derived from taking the sum of Y, XY, and X^2. This allows calculating the slope and y-intercept to generate the linear prediction equation. For a quadratic fit, additional normal equations are derived involving X^2Y, X^3, and X^4 to calculate the coefficients for the quadratic and linear terms to predict y values. Examples are provided to demonstrate fitting linear and quadratic equations to time series data using the least squares method.

Uploaded by

Ayaz Sultan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
208 views4 pages

Least Square Method

The least squares method fits an algebraic equation to data points by minimizing the sum of the squares of the residuals. It can be used for linear or nonlinear equations depending on the pattern of the data. For a linear fit, the normal equations are derived from taking the sum of Y, XY, and X^2. This allows calculating the slope and y-intercept to generate the linear prediction equation. For a quadratic fit, additional normal equations are derived involving X^2Y, X^3, and X^4 to calculate the coefficients for the quadratic and linear terms to predict y values. Examples are provided to demonstrate fitting linear and quadratic equations to time series data using the least squares method.

Uploaded by

Ayaz Sultan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

LEAST SQUARE METHOD

In this method, an algebraic equation is fitted to the given data points. This equation may be
Linear or Non-Linear depends upon the pattern of time series graph.

NOTE: If we are using Linear Equation, then we say that Linear Fitted Least-Square Method
and if we are using the Quadratic Equation then we say that Quadratic Fitted Least-Square
Method.

Linear Fitted Least - Square Method

Ŷ = a + b X --------------- (1)

Where The Normal Equations of (1) are given below

∑Y = na + b ∑X
and ∑XY = a ∑X + b ∑X2

EXP: For the given data: (For Odd Observed Points)

Year 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011
Price 7.5 7.8 8.2 8.2 8.4 8.5 8.7 9.1 9.3 9.7 9.9

Find a least Square (Linear Fitted) Method to compute the trends values and also find them.

Solution

YEAR PRICES (Y) X XY X2 Ŷ


2001 7.5 -5 -37.5 25 7.56
2002 7.8 -4 -31.2 16 7.78
2003 8.2 -3 -24.6 9 8.00
2004 8.2 -2 -16.4 4 8.22
2005 8.4 -1 -8.4 1 8.44
2006 8.5 0 0 0 8.66
2007 8.7 1 8.7 1 8.88
2008 9.1 2 18.2 4 9.1
2009 9.3 3 27.9 9 9.32
2010 9.7 4 38.8 16 9.54
2011 9.9 5 49.5 25 9.76
∑Y = 95.3 ∑X = 0 ∑XY = 25 ∑X = 110
2
Linear Fitted Least Square Method

Ŷ = a + b X --------------- (1)

∑Y = na + b ∑X ---------------- (a)
and ∑XY = a ∑X + b ∑X2 --------- (b)

(a) implies that, 95.3 = 11a + b(0)


=> 95.3 = 11a
=> a = 95.3/11 = 8.66

(b) implies that, 25 = 8.66(0) + b (110)


=> 25 = 0 + 110b
=> b = 25/110 = 0.22

(1) implies that

Ŷ = 8.66 + 0.22 X ------------------- (2)


(1) Put X = -5
Ŷ = 8.66 + 0.22 (-5) = 7.56

EXP: For the given data: (For Even observed Points)

Year 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010
Price 7.5 7.8 8.2 8.2 8.4 8.5 8.7 9.1 9.3 9.7

Find a least Square (Linear Fitted) Method to compute the trends values and also find them.

Solution

YEAR PRICES (Y) X XY X2 Ŷ


2001 7.5 -9
2002 7.8 -7
2003 8.2 -5
2004 8.2 -3
2005 8.4 -1
2006 8.5 +1
2007 8.7 +3
2008 9.1 +5
2009 9.3 +7
2010 9.7 +9
∑Y = ∑X = 0 ∑XY = ∑X2 =
Quadratic Fitted Least-Square Method

Ŷ = a + b X + c X2 ----------------- (1)

Where Normal Equations of (1) are

∑Y = na + b∑X + c∑X2
∑XY = a∑X + b∑X2 + c ∑X3
∑X2Y = a∑X2 + b∑X3 + c∑X4

EXP: Fit a Second degree (Quadratic) Fitted Least-Square Method (Curve) for the given data:

YEAR 2001 2002 2003 2004 2005


VALUES 13 24 39 65 106

Solution

YEAR Y X XY X2Y X2 X3 X4
2001 13 -2 -26 52 4 -8 16
2002 24 -1 -24 24 1 -1 1
2003 39 0 0 0 0 0 0
2004 65 +1 65 65 1 +1 1
2005 106 +2 212 424 4 +8 16
∑Y= 247 ∑X = 0 ∑XY=227 ∑X2Y=565 ∑X2=10 ∑X3 = 0 ∑X4=34

Ŷ = a + b X + c X2 ----------------- (1)

Where Normal Equations of (1) are

∑Y = na + b∑X + c∑X2 --------- (a)


∑XY = a∑X + b∑X2 + c ∑X3 ----------- (b)
∑X2Y = a∑X2 + b∑X3 + c∑X4 -------------- (c)

(a) implies that, 247 = 5a + b(0) + c(10) => 247 = 5a + 10c -------- (*)
(b) implies that, 227 = a(0) + b(10) + c(0) => 227 = 10b => b = 227/10 = 22.7
(c) implies that, 565 = a(10) + 22.7(0) + c(34) => 565 = 10a + 34c ------- (**)

Now we have two equations


247 = 5a + 10c ------ (*)
565 = 10a + 34c --------- (**)

a = 393 and c = 5.07


=> Ŷ = 393 + 22.7 X + 5.07 X2

You might also like