CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain...
-
Upload
spencer-todd -
Category
Documents
-
view
229 -
download
0
Transcript of CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain...
![Page 1: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/1.jpg)
CURVE FITTING
Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates.
There are two general approaches for curve fitting:• Regression:
Data exhibit a significant degree of scatter. The strategy is to derive a single curve that represents the general trend of the data.
• Interpolation: Data is very precise. The strategy is to pass a curve
or a series of curves through each of the points.
![Page 2: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/2.jpg)
Introduction
In engineering, two types of applications are encountered:
– Trend analysis. Predicting values of dependent variable, may include extrapolation beyond data points or interpolation between data points.
– Hypothesis testing. Comparing existing mathematical model with measured data.
![Page 3: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/3.jpg)
![Page 4: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/4.jpg)
Mathematical Background
• Arithmetic mean. The sum of the individual data points (yi) divided by the number of points (n).
• Standard deviation. The most common measure of a spread for a sample.
nin
yy i ,,1,
2)(,1
yySn
SS it
ty
![Page 5: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/5.jpg)
Mathematical Background (cont’d)
• Variance. Representation of spread by the square of the standard deviation.
or
• Coefficient of variation. Has the utility to quantify the spread of data.
1
/22
2
n
nyyS ii
y1
)( 22
n
yyS i
y
%100..y
Svc y
![Page 6: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/6.jpg)
Least Squares RegressionChapter 17
Linear Regression Fitting a straight line to a set of paired
observations: (x1, y1), (x2, y2),…,(xn, yn).
y = a0+ a1 x + e
a1 - slope
a0 - intercepte - error, or residual, between the model and the observations
![Page 7: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/7.jpg)
Linear Regression: Residual
![Page 8: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/8.jpg)
Linear Regression: Question
How to find a0 and a1 so that the error would be minimum?
![Page 9: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/9.jpg)
Linear Regression: Criteria for a “Best” Fit
n
iii
n
ii xaaye
110
1
)(min
e1e2
e1= -e2
![Page 10: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/10.jpg)
Linear Regression: Criteria for a “Best” Fit
n
iii
n
ii xaaye
110
1
||||min
![Page 11: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/11.jpg)
Linear Regression: Criteria for a “Best” Fit
||||max min 10
n
1iiii xaaye
![Page 12: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/12.jpg)
Linear Regression: Least Squares Fit
n
iii
n
iir xaayeS
1
210
1
2 )(min
n
i
n
iiiii
n
iir xaayyyeS
1 1
210
2
1
2 )()model,measured,(
Yields a unique line for a given set of data.
![Page 13: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/13.jpg)
Linear Regression: Least Squares Fit
n
iii
n
iir xaayeS
1
210
1
2 )(min
The coefficients a0 and a1 that minimize Sr must satisfy the following conditions:
0
0
1
0
a
S
a
S
r
r
![Page 14: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/14.jpg)
210
10
11
1
0
0
0)(2
0)(2
iiii
ii
iioir
ioio
r
xaxaxy
xaay
xxaaya
S
xaaya
S
Linear Regression: Determination of ao and a1
210
10
00
iiii
ii
xaxaxy
yaxna
naa
2 equations with 2 unknowns, can be solved simultaneously
![Page 15: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/15.jpg)
Linear Regression: Determination of ao and a1
221
ii
iiii
xxn
yxyxna
xaya 10
![Page 16: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/16.jpg)
![Page 17: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/17.jpg)
![Page 18: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/18.jpg)
![Page 19: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/19.jpg)
Error Quantification of Linear Regression
• Total sum of the squares around the mean for the dependent variable, y, is St
• Sum of the squares of residuals around the regression line is Sr
2it yyS )(
2n
1ii1oi
n
1i
2ir xaayeS )(
![Page 20: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/20.jpg)
Error Quantification of Linear Regression
• St-Sr quantifies the improvement or error reduction due to describing data in terms of a straight line rather than as an average value.
t
rt
S
SSr
2
r2: coefficient of determination
r : correlation coefficient
![Page 21: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/21.jpg)
Error Quantification of Linear Regression
For a perfect fit:
• Sr= 0 and r = r2 =1, signifying that the line explains 100 percent of the variability of the data.
• For r = r2 = 0, Sr = St, the fit represents no improvement.
![Page 22: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/22.jpg)
Least Squares Fit of a Straight Line: Example
Fit a straight line to the x and y values in the following Table:
5.119 ii yx
28 ix 0.24 iy
1402 ix
xi yi xiyi xi2
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
![Page 23: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/23.jpg)
Least Squares Fit of a Straight Line: Example (cont’d)
07142857.048392857.0428571.3
8392857.0281407
24285.1197
)(
10
2
221
xaya
xxn
yxyxna
ii
iiii
Y = 0.07142857 + 0.8392857 x
![Page 24: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/24.jpg)
Least Squares Fit of a Straight Line: Example (Error Analysis)
9911.22
ir eS
932.0868.02 rr
xi yi
1 0.52 2.53 2.04 4.05 3.56 6.07 5.5
8.5765 0.1687 0.8622 0.56252.0408 0.3473 0.3265 0.32650.0051 0.5896 6.6122 0.79724.2908 0.1993
2^
22 )( yy e)y(y iii
28 24.0 22.7143 2.9911
868.02
t
rt
S
SSr
7143.222 yyS it
![Page 25: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/25.jpg)
Least Squares Fit of a Straight Line: Example (Error Analysis)
9457.117
7143.22
1
n
Ss t
y
7735.027
9911.2
2/
n
Ss r
xy
yxy SS /
•The standard deviation (quantifies the spread around the mean):
•The standard error of estimate (quantifies the spread around the regression line)
Because , the linear regression model has good fitness
![Page 26: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/26.jpg)
Algorithm for linear regression
![Page 27: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/27.jpg)
Linearization of Nonlinear Relationships
• The relationship between the dependent and independent variables is linear.
• However, a few types of nonlinear functions can be transformed into linear regression problems.
The exponential equation. The power equation. The saturation-growth-rate equation.
![Page 28: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/28.jpg)
![Page 29: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/29.jpg)
Linearization of Nonlinear Relationships1. The exponential equation.
xbeay 11
xbay 11lnln
y* = ao + a1 x
![Page 30: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/30.jpg)
Linearization of Nonlinear Relationships2. The power equation
22
bxay
xbay logloglog 22
y* = ao + a1 x*
![Page 31: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/31.jpg)
Linearization of Nonlinear Relationships3. The saturation-growth-rate equation
xb
xay
33
xa
b
ay
111
3
3
3
y* = 1/yao = 1/a3
a1 = b3/a3
x* = 1/x
![Page 32: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/32.jpg)
ExampleFit the following Equation:
22
bxay
to the data in the following table:
xi yi
1 0.52 1.73 3.44 5.71 8.415 19.7
X*=log xi Y*=logyi
0 -0.3010.301 0.2260.477 0.5340.602 0.7530.699 0.9222.079 2.141
)log(log 22
bxay
2120
**
log
logloglet
b, aaa
x, y, X Y
xbay logloglog 22
*10
* XaaY
![Page 33: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/33.jpg)
Example
Xi Yi X*i=Log(X) Y*i=Log(Y) X*Y* X*^2
1 0.5 0.0000 -0.3010 0.0000 0.0000
2 1.7 0.3010 0.2304 0.0694 0.0906
3 3.4 0.4771 0.5315 0.2536 0.2276
4 5.7 0.6021 0.7559 0.4551 0.3625
5 8.4 0.6990 0.9243 0.6460 0.4886Sum 15 19.700 2.079 2.141 1.424 1.169
1 2 22
0 1
5 1.424 2.079 2.1411.75
5 1.169 2.079( )
0.4282 1.75 0.41584 0.334
i i i i
i i
n x y x ya
n x x
a y a x
![Page 34: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/34.jpg)
Linearization of Nonlinear Functions: Example
log y=-0.334+1.75log x
1.750.46y x
![Page 35: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/35.jpg)
Polynomial Regression
● Some engineering data is poorly represented by a straight line.
● For these cases a curve is better suited to fit the data. ● The least squares method can readily be extended to fit
the data to higher order polynomials.
![Page 36: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/36.jpg)
Polynomial Regression (cont’d)
A parabola is preferable
![Page 37: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/37.jpg)
Polynomial Regression (cont’d)
• A 2nd order polynomial (quadratic) is defined by:
● The residuals between the model and the data:
● The sum of squares of the residual:
exaxaay o 221
221 iioii xaxaaye
22
212
iioiir xaxaayeS
![Page 38: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/38.jpg)
Polynomial Regression (cont’d)
0xxaxaay2a
S
0xxaxaay2a
S
0xaxaay2a
S
2i
2i2i1oi
2
r
i2i2i1oi
1
r
2i2i1oi
o
r
)(
)(
)(
4i2
3i1
2ioi
2i
3i2
2i1ioii
2i2i1oi
xaxaxayx
xaxaxayx
xaxaany 3 linear equations with 3 unknowns (ao,a1,a2), can be solved
![Page 39: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/39.jpg)
Polynomial Regression (cont’d)
● A system of 3x3 equations needs to be solved to
determine the coefficients of the polynomial.
● The standard error & the coefficient of determination
3/
n
Ss r
xyt
rt
S
SSr
2
ii
ii
i
iii
iii
ii
yx
yx
y
a
a
a
xxx
xxx
xxn
22
1
0
432
32
2
![Page 40: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/40.jpg)
Polynomial Regression (cont’d)
General:
The mth-order polynomial:
● A system of (m+1)x(m+1) linear equations must be solved for
determining the coefficients of the mth-order polynomial.
● The standard error:
● The coefficient of determination:
exaxaxaay mmo .....2
21
1/
mn
Ss r
xy
t
rt
S
SSr
2
![Page 41: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/41.jpg)
Polynomial Regression- Example
Fit a second order polynomial to data:
2253 ix
9794 ix
xi yi xi2 xi3 xi4 xiyi xi2yi0 2.1 0 0 0 0 0
1 7.7 1 1 1 7.7 7.7
2 13.6 4 8 16 27.2 54.4
3 27.2 9 27 81 81.6 244.8
4 40.9 16 64 256 163.6 654.4
5 61.1 25 125 625 305.5 1527.5
15 152.6 55 225 979 585.6 2489
6.585 ii yx
15 ix
6.152 iy
552 ix
8.24882 ii yx
![Page 42: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/42.jpg)
Polynomial Regression- Example (cont’d)
● The system of simultaneous linear equations:
2
210
86071.135929.247857.2
86071.1,35929.2,47857.2
xxy
aaa
8.2488
6.585
6.152
97922555
2255515
55156
2
1
0
a
a
a
74657.32
ir eS 39.25132 yyS it
![Page 43: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/43.jpg)
Polynomial Regression- Example (cont’d)xi yi ymodel ei2 (yi-y`)2
0 2.1 2.4786 0.14332 544.42889
1 7.7 6.6986 1.00286 314.45929
2 13.6 14.64 1.08158 140.01989
3 27.2 26.303 0.80491 3.12229
4 40.9 41.687 0.61951 239.22809
5 61.1 60.793 0.09439 1272.13489
15 152.6 3.74657 2513.39333
•The standard error of estimate:
•The coefficient of determination:
12.136
74657.3/
xys
99925.0,99851.039.2513
74657.339.2513 22
rrr
![Page 44: CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for.](https://reader035.fdocuments.net/reader035/viewer/2022062407/56649f435503460f94c63d8e/html5/thumbnails/44.jpg)
Credits:● Chapra, Canale● The Islamic University of Gaza, Civil Engineering Department