curve fitting pertemuan 10 matakuliah: s0262-analisis numerik tahun: 2010
TRANSCRIPT
![Page 1: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/1.jpg)
![Page 2: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/2.jpg)
Curve FittingPertemuan 10
Matakuliah : S0262-Analisis NumerikTahun : 2010
![Page 3: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/3.jpg)
Material Outline
• Curve Fitting– Least square fit– Quantification of error– Coefficient of determination– Coefficient of correlation
![Page 4: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/4.jpg)
4
CURVE FITTING• In Curve Fitting, n pairs of numbers are expressed in
((x1,y1), (x2,y2), …(xn, yn)). These pairs are possibly from observation or field measurements of certain quantity.
• The objective: To find a certain function such that we can inter-relate the pairs of numbers, f(xj) yj. In other word, if the function is plotted, the resulted graph will best fit the pairs of numbers.
![Page 5: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/5.jpg)
5
CURVE FITTING
• One method that can be used to find the function for curve fitting of n pairs of observation values is to minimize the discrepancy between n pairs of observations with the curve.
• To minimize the discrepancy is known as Least Squared Regression.
• Least Squared Regression • Linear Regression• Polynomial Regression
![Page 6: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/6.jpg)
6
• LINEAR REGRESSIONIn Linear regression, n pairs observations or field measurements is fitted to a straight line (linear). Linear or straight line can be written as:y= a0 + a1 x + E, in which
a0: intercept, a1: slope, gradientE : error (discrepancy) between data points
with the chosen linear line model.The above equation can be written as :
E = y - a0 - a1 x From this equation, it can be seen that the error E is
the difference between the true value y with the approximate value a0 + a1 x.
![Page 7: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/7.jpg)
7
LINEAR REGRESSIONE = y - a0 - a1 x
There are several methods to find the Best Fit as to
1. Minimize the sum of the residual (error), E
2. Minimize the sum of the absolute of residual (error), |E|
3. Minimize the sum of the squared of residual (error), E2
Out of these 3 methods, the best method is to minimize the sum of the squared of residual (error), E2 . One of the advantage of using this method is that the resulted line is unique for each set of n pairs of data. This approach is known as Least Squares Fit.
![Page 8: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/8.jpg)
8
n
i
n
iiiir xaayES
1 1
210
2 )(
n
iiii
r
n
iii
r
xxaaya
S
xaaya
S
110
1
110
0
0))[(2
0)(2
Least Square Fit The coefisients a0 and a1 in the previous
equation will be determined by minimizing the sum of error (residual) squared as follows :
To minimize means (Calculus):
![Page 9: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/9.jpg)
9
n
xx
n
yy
xaya
xxn
yxyxna
n
ii
n
ii
n
ii
n
ii
n
i
n
ii
n
iiii
11
10
2
11
2
1 111
;
;
• Least Square Fit From previous equations then a0 and a1 can be
written as:
![Page 10: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/10.jpg)
10
2
)( 210
/
n
xaayS ii
xy
QUANTIFICATION OF ERROR OF LINEAR REGRESSIONStandard Deviation between prediction
model with data distribution can be quantified using the following
formula :
![Page 11: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/11.jpg)
11
QUANTIFICATION OF ERROR OF LINEAR REGRESSION
In addition to the sum of the squares of residuals (sr), there is a quantity the sum of the squares around the mean value st = (y-yi)2. The difference between st and sr quantifies the improvement or error reduction due to linear regression rather than average value. Two coefficients to quantifies this improvement is given below: Coefficients of determination (r2) and Correlation coeff. These 2 Coeff quantify the perfect ness of the fit of the linear regression
![Page 12: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/12.jpg)
12
2
210
22
)(
)()(
i
iii
yy
xaayyyr
Coefficient of Determination
Correlation Coeff r; 0 r 1;
r=1 Perfect Fit
r=0 No improvement st=sr
QUANTIFICATION OF ERROR OF LINEAR REGRESSION
![Page 13: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/13.jpg)
13
i xi yi
1 1 0,5
2 2 2,5
3 3 2,0
4 4 4,0
5 5 3,5
6 6 6,0
7 7 5,5
• Least Square Fit Example:
Find the linear regression line to fit the following data and estimate the
deviation standard.
![Page 14: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/14.jpg)
14
i xi yi xi yi xi2 yi-a0-a1xi
1 1 0,5 … … …
2 2 2,5 … … …
3 3 2,0 … … …
4 4 4,0 … … …
5 5 3,5 … … …
6 6 6,0 … … …
7 7 5,5 … … …
= … = … = … = … = …
• Answer:
![Page 15: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/15.jpg)
15
0
1
724
728
2
4285,342428
1405,1197
aa
yxyx
xyxn
ii
iii
Answer (cont): after completion of the previous Table
![Page 16: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/16.jpg)
16
• POLYNOMIAL REGRESSION For most cases the linear regression that just
discussed is appropriate to fit data distribution. For some case, however, it is not. For these cases, Polynomial functions can be used as an alternative.
Polynomial functions can be written as:
As before, the sum of the squares of error can be written as:
2
1
2210
n
i
mmir xaxaxaayS
mmxaxaxaay 2
210
![Page 17: Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010](https://reader030.vdocuments.mx/reader030/viewer/2022033105/5697c0151a28abf838ccdeec/html5/thumbnails/17.jpg)
17
• POLYNOMIAL REGRESSION In a polynomial function given before, there are
m+1 unknown quantities they are: a0, a1, …, am.
These quantities will be determined by minimizing the sum of the squares of error Sr as follows
From the above m+1 equations, the parameters a0, a1, …, am can be determined
000;0210
m
rrrr
a
s
a
s
a
s
a
s