SlideShare una empresa de Scribd logo
1 de 30
Descargar para leer sin conexión
1
Curve Fitting and Interpolation
Least-Squares Regression
2
• Fit the best curve to a discrete data set and
obtain estimates for other data points
• Two general approaches:
– Data exhibit a significant degree of scatter
Find a single curve that represents the
general trend of the data.
– Data is very precise. Pass a curve(s)
exactly through each of the points.
• Two common applications in engineering:
Trend analysis. Predicting values of dependent
variable: extrapolation beyond data points or
interpolation between data points.
Hypothesis testing. Comparing existing
mathematical model with measured data.
Curve Fitting
3
In sciences, if several measurements are made of a particular quantity,
additional insight can be gained by summarizing the data in one or more
well chosen statistics:
Arithmetic mean - The sum of the individual data points (yi)
divided by the number of points.
Standard deviation – a common measure of spread for a sample
or variance
Coefficient of variation –
quantifies the spread of data (similar to relative error)
n
i
n
y
y i
,
,
1 



1
2




n
y
y
S i
y
)
(
1
2
2




n
y
y
S i
y
)
(
Simple Statistics
%
100
.
.
y
S
v
c
y

4
yi : measured value
e : error
yi = a0 + a1 xi + e
e = yi - a0 - a1 xi
a1 : slope
a0 : intercept
Linear Regression
e Error
Line equation
y = a0 + a1 x
Given: n points (x1, y1), (x2, y2), …, (xn, yn)
Find: a line y = a0 + a1x that best fits the n points.
5
• Best strategy is to minimize the sum of the squares of the
residuals between the measured-y and the y calculated with the
linear model:
• Yields a unique line for a given set of data
• Need to compute a0 and a1 such that Sr is minimized!












n
i
i
i
r
n
i
model
i
measured
i
n
i
i
r
x
a
a
y
S
y
y
e
S
1
2
1
0
1
2
1
2
)
(
)
( ,
,
e Error
Minimize the sum of the residual errors for all available data?
  0
0
)
(
2
0
0
)
(
2
2
1
0
1
1
1
0
1






















 


 


i
i
i
i
i
i
o
i
r
i
i
i
o
i
o
r
x
a
x
a
x
y
x
x
a
a
y
a
S
x
a
a
y
x
a
a
y
a
S
Normal equations which can
be solved simultaneously
 
    i
i
i
i
i
i
x
y
a
x
a
x
y
a
x
na
na
a











1
2
0
1
0
0
0
(2)
(1)
Since

 





n
i
i
i
n
i
i
r x
a
a
y
e
S
1
2
1
0
1
2
)
(
:
error
Minimize
Least-Squares Fit of a Straight Line
7
Least-Squares Fit of a Line
 
 






0
2 1
0
0
i
i
r
x
a
a
y
a
S
 
 






0
]
[
2 1
0
1
i
i
i
r
x
x
a
a
y
a
S
  


 i
i y
a
x
na 1
0
To minimize Sr:
where and
 
 

  

 2
2
1
i
i
i
i
i
i
x
x
n
y
x
y
x
n
a
    



 i
i
i
i y
x
a
x
a
x 1
2
0
x
a
y
a 1
0 

n
y
y i


n
x
x i


y = a0 + a1x
Mean values
8
where and
 
 

  

 2
2
1
i
i
i
i
i
i
x
x
n
y
x
y
x
n
a
x
a
y
a 1
0 

n
y
y i


n
x
x i


y = a0 + a1x
Mean values
9
Is our prediction reliable?
Once an equation is found for the least square line, we need to have
some way of judging just how good the equation is for predictive
purposes. In order to have a quantitative basis for confidence in our
predictions, we need to calculate coefficient of correlation, denoted
r. It may be calculated using the following formula:
The value of r that is close to 1 or -1 (r2 = 1 ) indicates that our
formula will give us a reliable prediction
10
11
Example (1) of Least-Squares Fit of a Line
(Linear Regression)
12
7

n
5
119.

 i
i y
x 140
2

 i
x
  28
i
x 4
7
28


x
24

 i
y 428571
3
7
24
.


y
   
   
8392857
0
28
140
7
24
28
5
119
7
2
1 .
.




a   07142857
0
4
8392857
0
428571
3
0 .
.
. 


a
y = a0 + a1x
13
14
15
16
Example (2):
17
A sales manager noticed that the annual sales of his employees increase
with years of experience. To estimate the annual sales for his potential
new sales person he collected data concerning annual sales and years of
experience of his current employees: use his data to create a formula that
will help him estimate annual sales based on years of experience.
18
where and
 
 

  

 2
2
1
i
i
i
i
i
i
x
x
n
y
x
y
x
n
a
x
a
y
a 1
0 

n
y
y i


n
x
x i


y = a0 + a1x
Mean values
19
20
21
Linearization of Nonlinear Relationships
Nonlinear regression
Linear transformation (if possible)
Data that don’t fit linear form
22
Example (3) of Linearization
Linear regression on (log x, log y)
b2 = 1.75
x y log x log y
1 0.5 0 -0.301
2 1.7 0.301 0. 226
3 3.4 0.477 0.534
4 5.7 0.602 0.753
5 8.4 0.699 0.922
log y = 1.75 log x – 0.300
log a2 = – 0.300
a2 = 10-0.3 = 0.5
y = 0.5x1.75
23
Polynomial Regression
)
1
( 


m
n
S
s r
x
y /
 
2
1
2
2
1
0
 






n
i
m
i
m
i
i
i
r x
a
x
a
x
a
a
y
S ...
 
2
1
2
2
1
0
 




n
i
i
i
i
r x
a
x
a
a
y
S
Given: n points (x1, y1), (x2, y2), …, (xn, yn)
Find: a polynomial y = a0 + a1x + a2x2 + … amxm that minimizes
Example: 2nd-order polynomial y = a0 + a1x + a2x2
 
 







0
2 2
2
1
0
0
i
i
i
r
x
a
x
a
a
y
a
S
 
 







0
]
[
2 2
2
1
0
1
i
i
i
i
r
x
x
a
x
a
a
y
a
S
 
 







0
]
[
2
2
2
2
1
0
2
i
i
i
i
r
x
x
a
x
a
a
y
a
S
    




 i
i
i y
a
x
a
x
na 2
2
1
0
      





 i
i
i
i
i y
x
a
x
a
x
a
x 2
3
1
2
0
      





 i
i
i
i
i y
x
a
x
a
x
a
x
2
2
4
1
3
0
2
Standard error:
24
Example (4) of 2nd-order Polynomial Regression
25
m = 2 ∑xi = 15 ∑xi
4 = 979
n = 6 ∑yi = 152.6 ∑xiyi = 585.6
∑xi
2= 55 ∑xi
2yi = 2488.9
∑xi
3= 225































8
2488
6
585
6
152
979
225
55
225
55
15
55
15
6
2
1
0
.
.
.
a
a
a
5
2.

x
y = 2.47857 + 2.35929x + 1.86071x2
12
1
3
6
74657
3
.
.
/ 


x
y
s 99851
0
39
2513
74657
3
39
2513
2
.
.
.
.





t
r
t
S
S
S
r
433
25.

y
    




 i
i
i y
a
x
a
x
na 2
2
1
0
      





 i
i
i
i
i y
x
a
x
a
x
a
x 2
3
1
2
0
      





 i
i
i
i
i y
x
a
x
a
x
a
x
2
2
4
1
3
0
2
2nd-order polynomial y = a0 + a1x + a2x2
26
y = 2.47857 + 2.35929x + 1.86071x2
Example (5):
27
Fit a second-order polynomial to the data in the following table
    




 i
i
i y
a
x
a
x
na 2
2
1
0
      





 i
i
i
i
i y
x
a
x
a
x
a
x 2
3
1
2
0
      





 i
i
i
i
i y
x
a
x
a
x
a
x
2
2
4
1
3
0
2
2nd-order polynomial y = a0 + a1x + a2x2
28
    




 i
i
i y
a
x
a
x
na 2
2
1
0
      





 i
i
i
i
i y
x
a
x
a
x
a
x 2
3
1
2
0
      





 i
i
i
i
i y
x
a
x
a
x
a
x
2
2
4
1
3
0
2
2nd-order polynomial y = a0 + a1x + a2x2
29
Multiple Linear Regression
 
 







0
]
[
2 2
2
2
1
1
0
2
i
i
i
i
r
x
x
a
x
a
a
y
a
S
 
2
1
2
2
1
1
0
 




n
i
i
i
i
r x
a
x
a
a
y
S
Given: n points 3D (y1, x11, x12) (y2, x12, x22), …, (yn, x1n, x2n)
Find: a plane y = a0 + a1x1 + a2x2 that minimizes
 
 







0
2 2
2
1
1
0
0
i
i
i
r
x
a
x
a
a
y
a
S
 
 







0
]
[
2 1
2
2
1
1
0
1
i
i
i
i
r
x
x
a
x
a
a
y
a
S
    




 i
i
i y
a
x
a
x
na 2
2
1
1
0
      





 i
i
i
i
i
i y
x
a
x
x
a
x
a
x 1
2
2
1
1
2
1
0
1
      





 i
i
i
i
i
i y
x
a
x
a
x
x
a
x 2
2
2
2
1
2
1
0
2
Generation to m dimensions:
hyper plane y = a0 + a1x1 + a2x2 + … + amxm
30
General Linear Least Squares


















































n
m
mn
n
n
m
m
n e
e
e
a
a
a
z
z
z
z
z
z
z
z
z
y
y
y










2
1
1
0
1
0
2
12
02
1
11
01
2
1
Linear least squares: y = a0 + a1x1
Multi-linear least squares: y = a0 + a1x1 + a2x2 + … + amxm
Polynomial least squares: y = a0 + a1x + a2x2 + … amxm
2
1 0
1
2
 












 

n
i
m
j
ji
j
i
n
i
i
r z
a
y
e
S
   
      
 
Y
Z
A
Z
Z
T
T

y = a0z0 + a1z1 + a2z2 + … + amzm
{Y} = [Z] {A} + {E}
[C] {A} = {D}
([C] is symmetric, e.g. linear and polynomial)

Más contenido relacionado

La actualidad más candente

Method of least square
Method of least squareMethod of least square
Method of least square
Somya Bagai
 
Lu decomposition
Lu decompositionLu decomposition
Lu decomposition
gilandio
 

La actualidad más candente (20)

METHOD OF LEAST SQURE
METHOD OF LEAST SQUREMETHOD OF LEAST SQURE
METHOD OF LEAST SQURE
 
Curve fitting - Lecture Notes
Curve fitting - Lecture NotesCurve fitting - Lecture Notes
Curve fitting - Lecture Notes
 
Basic concepts of curve fittings
Basic concepts of curve fittingsBasic concepts of curve fittings
Basic concepts of curve fittings
 
Method of least square
Method of least squareMethod of least square
Method of least square
 
Mathematical modeling
Mathematical modelingMathematical modeling
Mathematical modeling
 
Polynomials and Curve Fitting in MATLAB
Polynomials and Curve Fitting in MATLABPolynomials and Curve Fitting in MATLAB
Polynomials and Curve Fitting in MATLAB
 
Applied numerical methods lec6
Applied numerical methods lec6Applied numerical methods lec6
Applied numerical methods lec6
 
Applied Numerical Methods Curve Fitting: Least Squares Regression, Interpolation
Applied Numerical Methods Curve Fitting: Least Squares Regression, InterpolationApplied Numerical Methods Curve Fitting: Least Squares Regression, Interpolation
Applied Numerical Methods Curve Fitting: Least Squares Regression, Interpolation
 
Curvefitting
CurvefittingCurvefitting
Curvefitting
 
Applications Section 1.3
Applications   Section 1.3Applications   Section 1.3
Applications Section 1.3
 
Applied numerical methods lec1
Applied numerical methods lec1Applied numerical methods lec1
Applied numerical methods lec1
 
Curve fitting
Curve fittingCurve fitting
Curve fitting
 
Curve fitting of exponential curve
Curve fitting of exponential curveCurve fitting of exponential curve
Curve fitting of exponential curve
 
Least Squares
Least SquaresLeast Squares
Least Squares
 
Least Squares method
Least Squares methodLeast Squares method
Least Squares method
 
Numerical method-Picards,Taylor and Curve Fitting.
Numerical method-Picards,Taylor and Curve Fitting.Numerical method-Picards,Taylor and Curve Fitting.
Numerical method-Picards,Taylor and Curve Fitting.
 
linear Algebra least squares
linear Algebra least squareslinear Algebra least squares
linear Algebra least squares
 
Linear Regression Ordinary Least Squares Distributed Calculation Example
Linear Regression Ordinary Least Squares Distributed Calculation ExampleLinear Regression Ordinary Least Squares Distributed Calculation Example
Linear Regression Ordinary Least Squares Distributed Calculation Example
 
Gaussian Elimination Method
Gaussian Elimination MethodGaussian Elimination Method
Gaussian Elimination Method
 
Lu decomposition
Lu decompositionLu decomposition
Lu decomposition
 

Destacado

6 heat treatment-of_steel
6 heat treatment-of_steel6 heat treatment-of_steel
6 heat treatment-of_steel
Mukhlis Adam
 
Curve Fitting results 1110
Curve Fitting results 1110Curve Fitting results 1110
Curve Fitting results 1110
Ray Wang
 
SJUT/Mat210/Regression/Intro 2013-14S2
SJUT/Mat210/Regression/Intro 2013-14S2SJUT/Mat210/Regression/Intro 2013-14S2
SJUT/Mat210/Regression/Intro 2013-14S2
John Ham
 
09 numerical differentiation
09 numerical differentiation09 numerical differentiation
09 numerical differentiation
Mohammad Tawfik
 
Ramos, alexis t. regression
Ramos, alexis t.   regressionRamos, alexis t.   regression
Ramos, alexis t. regression
ElaMeow
 
Hardening of steel by heat treatment
Hardening of steel by heat treatmentHardening of steel by heat treatment
Hardening of steel by heat treatment
Nikhil Azza
 
Polynomial functions
Polynomial functionsPolynomial functions
Polynomial functions
nicole379865
 
Polynomial Functions
Polynomial FunctionsPolynomial Functions
Polynomial Functions
nicole379865
 
Arithmetic sequences and arithmetic means
Arithmetic sequences and arithmetic meansArithmetic sequences and arithmetic means
Arithmetic sequences and arithmetic means
Denmar Marasigan
 
Eulermethod2
Eulermethod2Eulermethod2
Eulermethod2
stellajoh
 
Polynomial functions
Polynomial functionsPolynomial functions
Polynomial functions
Malikahmad105
 
Introduction to Polynomial Functions
Introduction to Polynomial FunctionsIntroduction to Polynomial Functions
Introduction to Polynomial Functions
kshoskey
 
25285 mws gen_int_ppt_trapcontinuous
25285 mws gen_int_ppt_trapcontinuous25285 mws gen_int_ppt_trapcontinuous
25285 mws gen_int_ppt_trapcontinuous
Jyoti Parange
 

Destacado (20)

Curve fitting
Curve fittingCurve fitting
Curve fitting
 
Numerical method (curve fitting)
Numerical method (curve fitting)Numerical method (curve fitting)
Numerical method (curve fitting)
 
6 heat treatment-of_steel
6 heat treatment-of_steel6 heat treatment-of_steel
6 heat treatment-of_steel
 
Curve Fitting results 1110
Curve Fitting results 1110Curve Fitting results 1110
Curve Fitting results 1110
 
SJUT/Mat210/Regression/Intro 2013-14S2
SJUT/Mat210/Regression/Intro 2013-14S2SJUT/Mat210/Regression/Intro 2013-14S2
SJUT/Mat210/Regression/Intro 2013-14S2
 
09 numerical differentiation
09 numerical differentiation09 numerical differentiation
09 numerical differentiation
 
Ramos, alexis t. regression
Ramos, alexis t.   regressionRamos, alexis t.   regression
Ramos, alexis t. regression
 
WF ED 540, CLASS MEETING 6, Linear Regression, 2016
WF ED 540, CLASS MEETING 6, Linear Regression, 2016WF ED 540, CLASS MEETING 6, Linear Regression, 2016
WF ED 540, CLASS MEETING 6, Linear Regression, 2016
 
151028_abajpai1
151028_abajpai1151028_abajpai1
151028_abajpai1
 
Hardening of steel by heat treatment
Hardening of steel by heat treatmentHardening of steel by heat treatment
Hardening of steel by heat treatment
 
Polynomial -ppt
Polynomial -pptPolynomial -ppt
Polynomial -ppt
 
case study of curve fitting
case study of curve fittingcase study of curve fitting
case study of curve fitting
 
Polynomial functions
Polynomial functionsPolynomial functions
Polynomial functions
 
Polynomial Functions
Polynomial FunctionsPolynomial Functions
Polynomial Functions
 
Arithmetic sequences and arithmetic means
Arithmetic sequences and arithmetic meansArithmetic sequences and arithmetic means
Arithmetic sequences and arithmetic means
 
Eulermethod2
Eulermethod2Eulermethod2
Eulermethod2
 
Polynomial functions
Polynomial functionsPolynomial functions
Polynomial functions
 
Introduction to Polynomial Functions
Introduction to Polynomial FunctionsIntroduction to Polynomial Functions
Introduction to Polynomial Functions
 
Regression
RegressionRegression
Regression
 
25285 mws gen_int_ppt_trapcontinuous
25285 mws gen_int_ppt_trapcontinuous25285 mws gen_int_ppt_trapcontinuous
25285 mws gen_int_ppt_trapcontinuous
 

Similar a Applied numerical methods lec8

Math Section 2.2 ECC Etudes
Math Section 2.2 ECC EtudesMath Section 2.2 ECC Etudes
Math Section 2.2 ECC Etudes
DavidYeeElCamino
 
Summary statistics (1)
Summary statistics (1)Summary statistics (1)
Summary statistics (1)
Godwin Okley
 

Similar a Applied numerical methods lec8 (20)

Nonparametric approach to multiple regression
Nonparametric approach to multiple regressionNonparametric approach to multiple regression
Nonparametric approach to multiple regression
 
Regression
RegressionRegression
Regression
 
Regression Analysis.pdf
Regression Analysis.pdfRegression Analysis.pdf
Regression Analysis.pdf
 
simple linear regression - brief introduction
simple linear regression - brief introductionsimple linear regression - brief introduction
simple linear regression - brief introduction
 
Es272 ch5a
Es272 ch5aEs272 ch5a
Es272 ch5a
 
Estimation of mean and its function using asymmetric loss function
Estimation of mean and its function using asymmetric loss function Estimation of mean and its function using asymmetric loss function
Estimation of mean and its function using asymmetric loss function
 
Estimation of mean and its function using asymmetric loss function
Estimation of mean and its function using asymmetric loss functionEstimation of mean and its function using asymmetric loss function
Estimation of mean and its function using asymmetric loss function
 
Regression analysis presentation
Regression analysis presentationRegression analysis presentation
Regression analysis presentation
 
Math Section 2.2 ECC Etudes
Math Section 2.2 ECC EtudesMath Section 2.2 ECC Etudes
Math Section 2.2 ECC Etudes
 
Lecture 2: Stochastic Hydrology
Lecture 2: Stochastic Hydrology Lecture 2: Stochastic Hydrology
Lecture 2: Stochastic Hydrology
 
mws_gen_reg_ppt_nonlinear.ppt
mws_gen_reg_ppt_nonlinear.pptmws_gen_reg_ppt_nonlinear.ppt
mws_gen_reg_ppt_nonlinear.ppt
 
Summary statistics (1)
Summary statistics (1)Summary statistics (1)
Summary statistics (1)
 
Lecture Notes in Econometrics Arsen Palestini.pdf
Lecture Notes in Econometrics Arsen Palestini.pdfLecture Notes in Econometrics Arsen Palestini.pdf
Lecture Notes in Econometrics Arsen Palestini.pdf
 
Mc1020
Mc1020Mc1020
Mc1020
 
Basics of Regression analysis
 Basics of Regression analysis Basics of Regression analysis
Basics of Regression analysis
 
Non-Gaussian Methods for Learning Linear Structural Equation Models: Part I
Non-Gaussian Methods for Learning Linear Structural Equation Models: Part INon-Gaussian Methods for Learning Linear Structural Equation Models: Part I
Non-Gaussian Methods for Learning Linear Structural Equation Models: Part I
 
Data-Handling part 2.ppt
Data-Handling part 2.pptData-Handling part 2.ppt
Data-Handling part 2.ppt
 
Principal Components Analysis, Calculation and Visualization
Principal Components Analysis, Calculation and VisualizationPrincipal Components Analysis, Calculation and Visualization
Principal Components Analysis, Calculation and Visualization
 
Comparison of Bayesian and non-Bayesian estimations for Type-II censored Gen...
Comparison of Bayesian and non-Bayesian estimations for  Type-II censored Gen...Comparison of Bayesian and non-Bayesian estimations for  Type-II censored Gen...
Comparison of Bayesian and non-Bayesian estimations for Type-II censored Gen...
 
Bba 3274 qm week 6 part 1 regression models
Bba 3274 qm week 6 part 1 regression modelsBba 3274 qm week 6 part 1 regression models
Bba 3274 qm week 6 part 1 regression models
 

Más de Yasser Ahmed

Artificial reefs
Artificial reefsArtificial reefs
Artificial reefs
Yasser Ahmed
 
Novel approach of bidirectional diffuser-augmented channels system for enhanc...
Novel approach of bidirectional diffuser-augmented channels system for enhanc...Novel approach of bidirectional diffuser-augmented channels system for enhanc...
Novel approach of bidirectional diffuser-augmented channels system for enhanc...
Yasser Ahmed
 

Más de Yasser Ahmed (13)

Artificial reefs
Artificial reefsArtificial reefs
Artificial reefs
 
Novel approach of bidirectional diffuser-augmented channels system for enhanc...
Novel approach of bidirectional diffuser-augmented channels system for enhanc...Novel approach of bidirectional diffuser-augmented channels system for enhanc...
Novel approach of bidirectional diffuser-augmented channels system for enhanc...
 
Applied numerical methods lec14
Applied numerical methods lec14Applied numerical methods lec14
Applied numerical methods lec14
 
Applied numerical methods lec13
Applied numerical methods lec13Applied numerical methods lec13
Applied numerical methods lec13
 
Applied numerical methods lec12
Applied numerical methods lec12Applied numerical methods lec12
Applied numerical methods lec12
 
Applied numerical methods lec11
Applied numerical methods lec11Applied numerical methods lec11
Applied numerical methods lec11
 
Applied numerical methods lec10
Applied numerical methods lec10Applied numerical methods lec10
Applied numerical methods lec10
 
Applied numerical methods lec9
Applied numerical methods lec9Applied numerical methods lec9
Applied numerical methods lec9
 
Applied numerical methods lec7
Applied numerical methods lec7Applied numerical methods lec7
Applied numerical methods lec7
 
Applied numerical methods lec5
Applied numerical methods lec5Applied numerical methods lec5
Applied numerical methods lec5
 
Applied numerical methods lec4
Applied numerical methods lec4Applied numerical methods lec4
Applied numerical methods lec4
 
Applied numerical methods lec3
Applied numerical methods lec3Applied numerical methods lec3
Applied numerical methods lec3
 
Applied numerical methods lec2
Applied numerical methods lec2Applied numerical methods lec2
Applied numerical methods lec2
 

Último

Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 

Último (20)

CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 

Applied numerical methods lec8

  • 1. 1 Curve Fitting and Interpolation Least-Squares Regression
  • 2. 2 • Fit the best curve to a discrete data set and obtain estimates for other data points • Two general approaches: – Data exhibit a significant degree of scatter Find a single curve that represents the general trend of the data. – Data is very precise. Pass a curve(s) exactly through each of the points. • Two common applications in engineering: Trend analysis. Predicting values of dependent variable: extrapolation beyond data points or interpolation between data points. Hypothesis testing. Comparing existing mathematical model with measured data. Curve Fitting
  • 3. 3 In sciences, if several measurements are made of a particular quantity, additional insight can be gained by summarizing the data in one or more well chosen statistics: Arithmetic mean - The sum of the individual data points (yi) divided by the number of points. Standard deviation – a common measure of spread for a sample or variance Coefficient of variation – quantifies the spread of data (similar to relative error) n i n y y i , , 1     1 2     n y y S i y ) ( 1 2 2     n y y S i y ) ( Simple Statistics % 100 . . y S v c y 
  • 4. 4 yi : measured value e : error yi = a0 + a1 xi + e e = yi - a0 - a1 xi a1 : slope a0 : intercept Linear Regression e Error Line equation y = a0 + a1 x Given: n points (x1, y1), (x2, y2), …, (xn, yn) Find: a line y = a0 + a1x that best fits the n points.
  • 5. 5 • Best strategy is to minimize the sum of the squares of the residuals between the measured-y and the y calculated with the linear model: • Yields a unique line for a given set of data • Need to compute a0 and a1 such that Sr is minimized!             n i i i r n i model i measured i n i i r x a a y S y y e S 1 2 1 0 1 2 1 2 ) ( ) ( , , e Error Minimize the sum of the residual errors for all available data?
  • 6.   0 0 ) ( 2 0 0 ) ( 2 2 1 0 1 1 1 0 1                               i i i i i i o i r i i i o i o r x a x a x y x x a a y a S x a a y x a a y a S Normal equations which can be solved simultaneously       i i i i i i x y a x a x y a x na na a            1 2 0 1 0 0 0 (2) (1) Since         n i i i n i i r x a a y e S 1 2 1 0 1 2 ) ( : error Minimize Least-Squares Fit of a Straight Line
  • 7. 7 Least-Squares Fit of a Line           0 2 1 0 0 i i r x a a y a S           0 ] [ 2 1 0 1 i i i r x x a a y a S       i i y a x na 1 0 To minimize Sr: where and           2 2 1 i i i i i i x x n y x y x n a          i i i i y x a x a x 1 2 0 x a y a 1 0   n y y i   n x x i   y = a0 + a1x Mean values
  • 8. 8 where and           2 2 1 i i i i i i x x n y x y x n a x a y a 1 0   n y y i   n x x i   y = a0 + a1x Mean values
  • 9. 9 Is our prediction reliable? Once an equation is found for the least square line, we need to have some way of judging just how good the equation is for predictive purposes. In order to have a quantitative basis for confidence in our predictions, we need to calculate coefficient of correlation, denoted r. It may be calculated using the following formula: The value of r that is close to 1 or -1 (r2 = 1 ) indicates that our formula will give us a reliable prediction
  • 10. 10
  • 11. 11 Example (1) of Least-Squares Fit of a Line (Linear Regression)
  • 12. 12 7  n 5 119.   i i y x 140 2   i x   28 i x 4 7 28   x 24   i y 428571 3 7 24 .   y         8392857 0 28 140 7 24 28 5 119 7 2 1 . .     a   07142857 0 4 8392857 0 428571 3 0 . . .    a y = a0 + a1x
  • 13. 13
  • 14. 14
  • 15. 15
  • 16. 16
  • 17. Example (2): 17 A sales manager noticed that the annual sales of his employees increase with years of experience. To estimate the annual sales for his potential new sales person he collected data concerning annual sales and years of experience of his current employees: use his data to create a formula that will help him estimate annual sales based on years of experience.
  • 18. 18 where and           2 2 1 i i i i i i x x n y x y x n a x a y a 1 0   n y y i   n x x i   y = a0 + a1x Mean values
  • 19. 19
  • 20. 20
  • 21. 21 Linearization of Nonlinear Relationships Nonlinear regression Linear transformation (if possible) Data that don’t fit linear form
  • 22. 22 Example (3) of Linearization Linear regression on (log x, log y) b2 = 1.75 x y log x log y 1 0.5 0 -0.301 2 1.7 0.301 0. 226 3 3.4 0.477 0.534 4 5.7 0.602 0.753 5 8.4 0.699 0.922 log y = 1.75 log x – 0.300 log a2 = – 0.300 a2 = 10-0.3 = 0.5 y = 0.5x1.75
  • 23. 23 Polynomial Regression ) 1 (    m n S s r x y /   2 1 2 2 1 0         n i m i m i i i r x a x a x a a y S ...   2 1 2 2 1 0       n i i i i r x a x a a y S Given: n points (x1, y1), (x2, y2), …, (xn, yn) Find: a polynomial y = a0 + a1x + a2x2 + … amxm that minimizes Example: 2nd-order polynomial y = a0 + a1x + a2x2            0 2 2 2 1 0 0 i i i r x a x a a y a S            0 ] [ 2 2 2 1 0 1 i i i i r x x a x a a y a S            0 ] [ 2 2 2 2 1 0 2 i i i i r x x a x a a y a S           i i i y a x a x na 2 2 1 0              i i i i i y x a x a x a x 2 3 1 2 0              i i i i i y x a x a x a x 2 2 4 1 3 0 2 Standard error:
  • 24. 24 Example (4) of 2nd-order Polynomial Regression
  • 25. 25 m = 2 ∑xi = 15 ∑xi 4 = 979 n = 6 ∑yi = 152.6 ∑xiyi = 585.6 ∑xi 2= 55 ∑xi 2yi = 2488.9 ∑xi 3= 225                                8 2488 6 585 6 152 979 225 55 225 55 15 55 15 6 2 1 0 . . . a a a 5 2.  x y = 2.47857 + 2.35929x + 1.86071x2 12 1 3 6 74657 3 . . /    x y s 99851 0 39 2513 74657 3 39 2513 2 . . . .      t r t S S S r 433 25.  y           i i i y a x a x na 2 2 1 0              i i i i i y x a x a x a x 2 3 1 2 0              i i i i i y x a x a x a x 2 2 4 1 3 0 2 2nd-order polynomial y = a0 + a1x + a2x2
  • 26. 26 y = 2.47857 + 2.35929x + 1.86071x2
  • 27. Example (5): 27 Fit a second-order polynomial to the data in the following table           i i i y a x a x na 2 2 1 0              i i i i i y x a x a x a x 2 3 1 2 0              i i i i i y x a x a x a x 2 2 4 1 3 0 2 2nd-order polynomial y = a0 + a1x + a2x2
  • 28. 28           i i i y a x a x na 2 2 1 0              i i i i i y x a x a x a x 2 3 1 2 0              i i i i i y x a x a x a x 2 2 4 1 3 0 2 2nd-order polynomial y = a0 + a1x + a2x2
  • 29. 29 Multiple Linear Regression            0 ] [ 2 2 2 2 1 1 0 2 i i i i r x x a x a a y a S   2 1 2 2 1 1 0       n i i i i r x a x a a y S Given: n points 3D (y1, x11, x12) (y2, x12, x22), …, (yn, x1n, x2n) Find: a plane y = a0 + a1x1 + a2x2 that minimizes            0 2 2 2 1 1 0 0 i i i r x a x a a y a S            0 ] [ 2 1 2 2 1 1 0 1 i i i i r x x a x a a y a S           i i i y a x a x na 2 2 1 1 0              i i i i i i y x a x x a x a x 1 2 2 1 1 2 1 0 1              i i i i i i y x a x a x x a x 2 2 2 2 1 2 1 0 2 Generation to m dimensions: hyper plane y = a0 + a1x1 + a2x2 + … + amxm
  • 30. 30 General Linear Least Squares                                                   n m mn n n m m n e e e a a a z z z z z z z z z y y y           2 1 1 0 1 0 2 12 02 1 11 01 2 1 Linear least squares: y = a0 + a1x1 Multi-linear least squares: y = a0 + a1x1 + a2x2 + … + amxm Polynomial least squares: y = a0 + a1x + a2x2 + … amxm 2 1 0 1 2                  n i m j ji j i n i i r z a y e S              Y Z A Z Z T T  y = a0z0 + a1z1 + a2z2 + … + amzm {Y} = [Z] {A} + {E} [C] {A} = {D} ([C] is symmetric, e.g. linear and polynomial)