Post on 13-Jun-2015
description
METHOD OF LEAST SQURE
Mirza Danial Masood
BSIT(B), UOS M.B.Din
OVERVIEW
The method of least squares is a standard approach to the approximate solution of over determined systems, i.e., sets of equations in which there are more equations than unknowns.
"Least squares" means that the overall solution minimizes the sum of the squares of the errors made in the results of every single equation.
The least-squares method is usually credited to Carl Friedrich Gauss (1795), but it was first published by Adrien-Marie Legendre.
Linear Regression A linear regression is a statistical analysis
assessing the association between two variables. It is used to find the relationship between two variables.
Regression Equation(y) = a + bx Slope(b) = (NΣXY - (ΣX)(ΣY)) / (NΣX2 - (ΣX)2) Intercept(a) = (ΣY - b(ΣX)) /
N
WORKING PROCEDURE
To fit the straight line y=a+bx: Substitute the observed set of n values in this
equation. Form the normal equations for each constant i.e.
∑y=na+b∑x, ∑xy=a∑x+b∑x2 . Solve these normal equations as simultaneous
equations of a and b. Substitute the values of a and b in y=a+bx,
which is the required line of best fit.
EXAMPLE OF STRAIGHT LINEFit a straight line to the x and y values in the following Table:
xiyi xiyi xi
2
1 0.5 0.5 1
2 2.5 5 4
3 2 6 9
4 4 16 16
5 3.5 17.5 25
6 6 36 36
7 5.5 38.5 49
28 24 119.5
140
28 ix 0.24 iy
1402 ix 5.119 ii yx
428571.37
24 4
7
28 yx
428571.37
24 4
7
28 yx
EXAMPLE OF STRAIGHT LINE
07142857.048392857.0428571.3
8392857.0281407
24285.1197
)(
10
2
221
xaya
xxn
yxyxna
ii
iiii
Y = 0.07142857 + 0.8392857x
*10
* XaaY
EXAMPLE OF STRAIGHT LINE
Suppose if we want to know the approximate y value for the variable x = 4. Then we can substitute the value in the above equation.
*10
* XaaY Y = 0.07142857 + 0.8392857x
Y = 0.07142857 + 0.8392857(4)
Y = 0.07142857 + 3.3571428
Y = 3.42857137 Ans
EXAMPLE OF STRAIGHT LINE
EXAMPLE OF OTHER CURVE Fit the following Equation:
to the data in the following table:0.24 iy
xi yi X*=log xi Y*=logyi
1 0.5 0 -0.301
2 1.7 0.301 0.266
3 3.4 0.477 0.534
4 5.7 0.602 0.753
5 8.4 0.699 0.922
15 19.7 2.079 2.141
)log(log 22
bxay
2120
**
log
logloglet
b, aaa
x, y, X Y
xbay logloglog 22
*10
* XaaY
EXAMPLE OF OTHER CURVE
EXAMPLE OF OTHER CURVE
REFERANCE
• http://en.wikipedia.org/wiki/Least_squares
• http://mathworld.wolfram.com/LeastSquaresFitting.html
• http://hotmath.com/hotmath_help/topics/line-of-best-fit.html
• http://hotmath.com/hotmath_help/topics/line-of-best-fit.html