SlideShare a Scribd company logo
1 of 22
Least Square
Fitting
Motivation
Humans’ natural instinct to find patterns
Introduction
 Least Square Methods (LSM) is probably the
most popular technique in statistics for
modelling.
 With applications in fields as diverse as
statistics, finance, medicines, economics &
psychology.
 Least squares is a way to use data to make
quantitative predictions.
History
Gauss
Legendre
First published by Legendre in 1805’s
paper ‘New Methods for Determination
of the Orbits of Comets’.
In 1809, Gauss published a memoir in
which he mentioned that he had
previously discovered LSM and it as
early as 1795 in estimating the orbit of
an asteroid.
Both Gauss and Legendre used the
method of least squares to understand
the orbits of comets, based on inexact
measurements of the comets’ previous
locations.
Curve Fitting
 What is curve fitting?
 capturing the trend in the data by assigning a
single function across the entire range.
For example…
x
y
Approximate fitting of a straight line
f(x) = ax + b
For each line
Interpolation
x
f(x)
f(x) = ax + b
For each line
Curve Fitting
f(x) = ax + b
For entire range
x
f(x)
The straight line,
𝒇 𝒙 = 𝒂𝒙 + 𝒃
should be fitted through the given points
𝒙 𝟏, 𝒚 𝟏 , … , (𝒙 𝒏, 𝒚 𝒏) so that the sum of the squares of the
distances of those points from the straight line is
minimum, where the distance is measured in the vertical
direction (the y-direction).
 The distance between the observed
point and expected point is called
‘error’ or ‘residual’;
𝒆𝒊 = 𝒚𝒊 − 𝒇(𝒙𝒊)
Least Squares Method
 The ‘best’ line has minimum error between line and data points.
x
y 𝒙𝒊, 𝒚𝒊
𝒚𝒊 − 𝒂 − 𝒃𝒙𝒊
𝒂 + 𝒃𝒙𝒊
𝒚 = 𝒂 + 𝒃𝒙
𝒙𝒊
x
f(x)
What makes a particular straight line
a ‘good’ fit?
(𝒙 𝟐, 𝒚 𝟐)
(𝒙 𝟒, 𝒚 𝟒)
(𝒙 𝟏, 𝒚 𝟏)
(𝒙 𝟑, 𝒚 𝟑)
(𝒙 𝟏, 𝒇(𝒙 𝟏) )
(𝒙 𝟐, 𝒇(𝒙 𝟐) )
(𝒙 𝟑, 𝒇(𝒙 𝟑) )
(𝒙 𝟒, 𝒇(𝒙 𝟒) )
x
f(x)
What makes a particular straight line
a ‘good’ fit?
 Minimize 𝜮𝒆𝒊
𝟐
𝑬 =
𝒊=𝟏
𝒏
𝒆𝒊
𝟐
=
𝒊=𝟏
𝒏
𝒚𝒊 − 𝒇(𝒙𝒊) 𝟐 =
𝒊=𝟏
𝒏
𝒚𝒊 − (𝒂𝒙𝒊 + 𝒃) 𝟐
E= 𝒚 𝟏 − (𝒂𝒙 𝟏 + 𝒃) 𝟐
+ 𝒚 𝟐 − (𝒂𝒙 𝟐 + 𝒃) 𝟐
+ ………. +
𝒚 𝒏 − (𝒂𝒙 𝒏 + 𝒃) 𝟐
 This is called the least squares approach, since square
of the error is minimized.
How do we compute ‘a’ and ‘b’
after a definition of “good fit” is obtained?
  






 
N
i
ii baxyE
1
2Minimize
Contd. ……computing ‘a’ and ‘b’
𝝏𝑬
𝝏𝒂
= −𝟐
𝒊=𝟏
𝒏
𝒙𝒊 (𝒚𝒊 − 𝒂𝒙𝒊 − 𝒃) = 0
𝝏𝑬
𝝏𝒃
= −𝟐
𝒊=𝟏
𝒏
(𝒚𝒊 − 𝒂𝒙𝒊 − 𝒃) = 0
Normal Equations
𝒂
𝒊=𝟏
𝒏
𝒙𝒊
𝟐
+ 𝒃
𝒊=𝟏
𝒏
𝒙𝒊 =
𝒊=𝟏
𝒏
𝒙𝒊 𝒚𝒊
𝒂
𝒊=𝟏
𝒏
𝒙𝒊 + 𝒃 𝒏 =
𝒊=𝟏
𝒏
𝒚𝒊
Put these into matrix form
𝒏
𝒊=𝟏
𝒏
𝒙𝒊
𝒊=𝟏
𝒏
𝒙𝒊
𝒊=𝟏
𝒏
𝒙𝒊
𝟐
𝒃
𝒂
= 𝒊=𝟏
𝒏
𝒚𝒊
𝒊=𝟏
𝒏
𝒙𝒊 𝒚𝒊
𝑨𝑿 = 𝑩
Coefficients a and b can be
obtained by solving
𝑿 = 𝑨−𝟏 ∗ 𝑩
𝒂 =
𝒏 𝒊=𝟏
𝒏
𝒙𝒊 𝒚𝒊 − 𝒊=𝟏
𝒏
𝒙𝒊 𝒊=𝟏
𝒏
𝒚𝒊
𝒏 𝒊=𝟏
𝒏
𝒙𝒊
𝟐
− 𝒊=𝟏
𝒏
𝒙𝒊
𝟐
𝒃 =
𝒊=𝟏
𝒏
𝒚𝒊 𝒊=𝟏
𝒏
𝒙𝒊
𝟐
− 𝒊=𝟏
𝒏
𝒙𝒊 𝒊=𝟏
𝒏
𝒙𝒊 𝒚𝒊
𝒏 𝒊=𝟏
𝒏
𝒙𝒊
𝟐
− 𝒊=𝟏
𝒏
𝒙𝒊
𝟐
0 1 2 3 4 5 6 7
x
12
10
8
6
4
2
0
-2
y
What is “Good Fit”?
𝒇(𝒙) =
𝒄 𝟏
𝒙
+
𝒄 𝟐
𝒙
𝒇 𝒙 = 𝒄 𝟏 𝒙 𝟐
+ 𝒄 𝟐 𝒙 + 𝒄 𝟑
The Least-Squares mth Degree
Polynomials
 Using a polynomial of degree m
𝒚 = 𝒂 𝟎 + 𝒂 𝟏 𝒙 + 𝒂 𝟐 𝒙 𝟐
+ ⋯ + 𝒂 𝒎 𝒙 𝒎
 To approx. given set of data 𝒙 𝟏, 𝒚 𝟏 , 𝒙 𝟐, 𝒚 𝟐 , … , (𝒙 𝒏, 𝒚 𝒏) where
𝒎 ≤ 𝒏 − 𝟏, the best fitting curve has the least square error, i.e.,
𝑴𝒊𝒏𝒊𝒎𝒊𝒛𝒆{𝑬 =
𝒊=𝟏
𝒏
{𝒚𝒊 − 𝒇(𝒙𝒊)} 𝟐
}
𝑬 =
𝒊=𝟏
𝒏
{𝒚𝒊 − 𝒂 𝟎 + 𝒂 𝟏 𝒙𝒊 + 𝒂 𝟐 𝒙𝒊
𝟐
+ ⋯ + 𝒂 𝒎 𝒙𝒊
𝒎
} 𝟐
 Obtain normal equations
𝝏𝑬
𝝏𝒂 𝟎
= 𝟎,
𝝏𝑬
𝝏𝒂 𝟏
= 𝟎, … . ,
𝝏𝑬
𝝏𝒂 𝒎
= 𝟎
 The normal equations can be put in matrix form
𝑨𝑿 = 𝑩 which can be solved to get 𝑿 = 𝑨−𝟏 ∗ B
Fitting a Second Degree
(Parabola) Polynomial
 Parabolic Trend is given by 𝒚 = 𝒂 𝟎 + 𝒂 𝟏 𝒙 + 𝒂 𝟐 𝒙 𝟐
 Then error is; 𝑬 = (𝒚 − (𝒂 𝟎+𝒂 𝟏 𝒙 + 𝒂 𝟐 𝒙 𝟐))
𝟐
 Minimizing

𝝏𝑬
𝝏𝒂 𝟎
= 𝟎 = −𝟐 (𝒚 − 𝒂 𝟎 + 𝒂 𝟏 𝒙 + 𝒂 𝟐 𝒙 𝟐
)

𝝏𝑬
𝝏𝒂 𝟏
= 𝟎 = −𝟐 𝒙(𝒚 − 𝒂 𝟎 + 𝒂 𝟏 𝒙 + 𝒂 𝟐 𝒙 𝟐)

𝝏𝑬
𝝏𝒂 𝟐
= 𝟎 = −𝟐 𝒙 𝟐(𝒚 − 𝒂 𝟎 + 𝒂 𝟏 𝒙 + 𝒂 𝟐 𝒙 𝟐)
 Normal equations are
 𝒚 = 𝒏𝒂 𝟎 + 𝒂 𝟏 𝒕 + 𝒂 𝟐 𝒙 𝟐
 𝒙𝒚 = 𝒂 𝟎 𝒙 + 𝒂 𝟏 𝒙 𝟐
+ 𝒂 𝟐 𝒙 𝟑
 𝒙 𝟐
𝒚 = 𝒂 𝟎 𝒙 𝟐
+ 𝒂 𝟏 𝒙 𝟑
+ 𝒂 𝟑 𝒙 𝟒
Different Cases
Limitations
 Most serious limitation: The determination of the
type of the trend curve to be fitted, whether we
should fit a linear or a parabolic trend or some
other more complicated trend curve.
 The addition of single new observation
necessitates all the calculations to be done
afresh.
 This method requires more calculations and
quite tedious and time consuming as compared
with other methods.
 If P is the pull required to pull the load W by means of a pulley
block, find a linear law of the form P=mW+ c connecting P and
W (in kg.wt), using the following data
Compute P when W=150 kg.wt
 Sol- The corresponding normal Equations are
𝑃 = 4𝑐 + 𝑚 𝑊 ; 𝑊𝑃 = 𝑐 𝑊 + 𝑚 𝑊2
P= 12 15 21 25
W=50 70 100 120
W P W² WP
50
70
100
120
12
15
21
25
2500
4900
10000
14400
600
1050
2100
3000
Total =340 73 31800 6750
Example
 Substituting the values
73 = 4c + 340m ;
6750 = 340c + 31800m
Example contd…
 With little algebra,
we get
m = 0.1879 & c = 2.2785
Hence the line if best fit is
P = 2.2759 + 0.1879 W
When W= 150 kg,
P= 2.2785 + 0.1879 X 150 = 30.4635
0
5
10
15
20
25
30
0 50 100 150
P
W
P vs W
P
0
5
10
15
20
25
30
0 50 100 150
P
W
P vs W
P(expected)
References
 https://priceonomics.com/the-discovery-of-statistical-regression/
 http://web.iitd.ac.in/~pmvs/courses/mel705/curvefitting.pdf
 Least Squares Fitting of Data to a Curve/ Gerald Recktenwald/
Portland State University/ Department of Mechanical Engineering
 Fundamentals of Statistics, S.C. Gupta
 Higher Engineering Methods, Dr. B.S. Grewal
 Advanced Engineering Method, ERWIN KREYSZIG
 http://mathworld.wolfram.com/LeastSquaresFittingLogarithmic.htm
l
 http://mathworld.wolfram.com/LeastSquaresFittingExponential.html
 http://mathworld.wolfram.com/LeastSquaresFittingPowerLaw.html
Thank You

More Related Content

What's hot

Chemistry and formulation of para phenylene diamine based hair dye
Chemistry and formulation of para phenylene diamine based hair dyeChemistry and formulation of para phenylene diamine based hair dye
Chemistry and formulation of para phenylene diamine based hair dyeSteffi Thomas
 
Least square method
Least square methodLeast square method
Least square methodPandidurai P
 
Least Squares Regression Method | Edureka
Least Squares Regression Method | EdurekaLeast Squares Regression Method | Edureka
Least Squares Regression Method | EdurekaEdureka!
 
UNIT IV.pptx Principle of cosmetic evaluation.
UNIT IV.pptx  Principle of cosmetic evaluation.UNIT IV.pptx  Principle of cosmetic evaluation.
UNIT IV.pptx Principle of cosmetic evaluation.Priya Patil
 
Optimization techniques in pharmaceutical formulation and processing
Optimization techniques in pharmaceutical formulation and processingOptimization techniques in pharmaceutical formulation and processing
Optimization techniques in pharmaceutical formulation and processingPratiksha Chandragirivar
 
Parametric test _ t test and ANOVA _ Biostatistics and Research Methodology....
Parametric test _ t test and ANOVA _  Biostatistics and Research Methodology....Parametric test _ t test and ANOVA _  Biostatistics and Research Methodology....
Parametric test _ t test and ANOVA _ Biostatistics and Research Methodology....AZCPh
 
Probability ,Binomial distribution, Normal distribution, Poisson’s distributi...
Probability ,Binomial distribution, Normal distribution, Poisson’s distributi...Probability ,Binomial distribution, Normal distribution, Poisson’s distributi...
Probability ,Binomial distribution, Normal distribution, Poisson’s distributi...AZCPh
 
Optimization techniques
Optimization techniquesOptimization techniques
Optimization techniquesprashik shimpi
 
Applications of sas and minitab in data analysis
Applications of sas and minitab in data analysisApplications of sas and minitab in data analysis
Applications of sas and minitab in data analysisVeenaV29
 
Regression Analysis
Regression AnalysisRegression Analysis
Regression AnalysisASAD ALI
 
Optimization techniques in pharmaceutical formulation and processing
Optimization techniques in pharmaceutical formulation and processingOptimization techniques in pharmaceutical formulation and processing
Optimization techniques in pharmaceutical formulation and processingReshma Fathima .K
 
Introduction to Research.pdf
Introduction to Research.pdfIntroduction to Research.pdf
Introduction to Research.pdfRavinandan A P
 
introduction to biostatistics.pptx
introduction to biostatistics.pptxintroduction to biostatistics.pptx
introduction to biostatistics.pptxSreeLatha98
 

What's hot (20)

Chemistry and formulation of para phenylene diamine based hair dye
Chemistry and formulation of para phenylene diamine based hair dyeChemistry and formulation of para phenylene diamine based hair dye
Chemistry and formulation of para phenylene diamine based hair dye
 
Regression ppt
Regression pptRegression ppt
Regression ppt
 
Regression analysis
Regression analysisRegression analysis
Regression analysis
 
Curve fitting
Curve fittingCurve fitting
Curve fitting
 
Graphs (Biostatistics)
Graphs (Biostatistics)Graphs (Biostatistics)
Graphs (Biostatistics)
 
Least square method
Least square methodLeast square method
Least square method
 
Optimization techniques
Optimization techniques Optimization techniques
Optimization techniques
 
Curve Fitting
Curve FittingCurve Fitting
Curve Fitting
 
Least Squares Regression Method | Edureka
Least Squares Regression Method | EdurekaLeast Squares Regression Method | Edureka
Least Squares Regression Method | Edureka
 
UNIT IV.pptx Principle of cosmetic evaluation.
UNIT IV.pptx  Principle of cosmetic evaluation.UNIT IV.pptx  Principle of cosmetic evaluation.
UNIT IV.pptx Principle of cosmetic evaluation.
 
Optimization techniques in pharmaceutical formulation and processing
Optimization techniques in pharmaceutical formulation and processingOptimization techniques in pharmaceutical formulation and processing
Optimization techniques in pharmaceutical formulation and processing
 
Curve fitting
Curve fitting Curve fitting
Curve fitting
 
Parametric test _ t test and ANOVA _ Biostatistics and Research Methodology....
Parametric test _ t test and ANOVA _  Biostatistics and Research Methodology....Parametric test _ t test and ANOVA _  Biostatistics and Research Methodology....
Parametric test _ t test and ANOVA _ Biostatistics and Research Methodology....
 
Probability ,Binomial distribution, Normal distribution, Poisson’s distributi...
Probability ,Binomial distribution, Normal distribution, Poisson’s distributi...Probability ,Binomial distribution, Normal distribution, Poisson’s distributi...
Probability ,Binomial distribution, Normal distribution, Poisson’s distributi...
 
Optimization techniques
Optimization techniquesOptimization techniques
Optimization techniques
 
Applications of sas and minitab in data analysis
Applications of sas and minitab in data analysisApplications of sas and minitab in data analysis
Applications of sas and minitab in data analysis
 
Regression Analysis
Regression AnalysisRegression Analysis
Regression Analysis
 
Optimization techniques in pharmaceutical formulation and processing
Optimization techniques in pharmaceutical formulation and processingOptimization techniques in pharmaceutical formulation and processing
Optimization techniques in pharmaceutical formulation and processing
 
Introduction to Research.pdf
Introduction to Research.pdfIntroduction to Research.pdf
Introduction to Research.pdf
 
introduction to biostatistics.pptx
introduction to biostatistics.pptxintroduction to biostatistics.pptx
introduction to biostatistics.pptx
 

Similar to Least Squares Fitting

Graphs of Linear Equations in Two Variables
Graphs of Linear Equations in Two VariablesGraphs of Linear Equations in Two Variables
Graphs of Linear Equations in Two VariablesCABILACedricLyoidJ
 
Math 8 Lesson 3 - 1st Quarter
Math 8 Lesson 3 - 1st QuarterMath 8 Lesson 3 - 1st Quarter
Math 8 Lesson 3 - 1st Quarteralicelagajino
 
General Math Lesson 2
General Math Lesson 2General Math Lesson 2
General Math Lesson 2alicelagajino
 
Differential Geometry for Machine Learning
Differential Geometry for Machine LearningDifferential Geometry for Machine Learning
Differential Geometry for Machine LearningSEMINARGROOT
 
Ejercicios propuestos 3 Estructuras Discretas II Verónica Torres
Ejercicios propuestos 3 Estructuras Discretas II Verónica Torres Ejercicios propuestos 3 Estructuras Discretas II Verónica Torres
Ejercicios propuestos 3 Estructuras Discretas II Verónica Torres Veronica Torres
 
Module03 the mean and standard deviation of random variable
Module03 the mean and standard deviation of random variableModule03 the mean and standard deviation of random variable
Module03 the mean and standard deviation of random variableREYEMMANUELILUMBA
 
Jordan Higher (𝜎, 𝜏)-Centralizer on Prime Ring
Jordan Higher (𝜎, 𝜏)-Centralizer on Prime RingJordan Higher (𝜎, 𝜏)-Centralizer on Prime Ring
Jordan Higher (𝜎, 𝜏)-Centralizer on Prime RingIOSR Journals
 
Joint and Combined Variation (Mathematics 9)
Joint and Combined Variation (Mathematics 9)Joint and Combined Variation (Mathematics 9)
Joint and Combined Variation (Mathematics 9)BevBeverlyGelbolingo
 
General Math Lesson 3
General Math Lesson 3General Math Lesson 3
General Math Lesson 3alicelagajino
 
Limit of complex number
Limit of complex numberLimit of complex number
Limit of complex numberBilal Amjad
 
Least Square Plane and Leastsquare Quadric Surface Approximation by Using Mod...
Least Square Plane and Leastsquare Quadric Surface Approximation by Using Mod...Least Square Plane and Leastsquare Quadric Surface Approximation by Using Mod...
Least Square Plane and Leastsquare Quadric Surface Approximation by Using Mod...IOSRJM
 
SUEC 高中 Adv Maths (Trigo Function Part 3)
SUEC 高中 Adv Maths (Trigo Function Part 3)SUEC 高中 Adv Maths (Trigo Function Part 3)
SUEC 高中 Adv Maths (Trigo Function Part 3)tungwc
 
Unit 4 numericals on power screws 2
Unit  4 numericals on power screws 2Unit  4 numericals on power screws 2
Unit 4 numericals on power screws 2pradnyakosbe
 
Paul Bleau Calc III Project 2 - Basel Problem
Paul Bleau Calc III Project 2 - Basel ProblemPaul Bleau Calc III Project 2 - Basel Problem
Paul Bleau Calc III Project 2 - Basel ProblemPaul Bleau
 
Stability criterion of periodic oscillations in a (14)
Stability criterion of periodic oscillations in a (14)Stability criterion of periodic oscillations in a (14)
Stability criterion of periodic oscillations in a (14)Alexander Decker
 

Similar to Least Squares Fitting (20)

Graphs of Linear Equations in Two Variables
Graphs of Linear Equations in Two VariablesGraphs of Linear Equations in Two Variables
Graphs of Linear Equations in Two Variables
 
Math 8 Lesson 3 - 1st Quarter
Math 8 Lesson 3 - 1st QuarterMath 8 Lesson 3 - 1st Quarter
Math 8 Lesson 3 - 1st Quarter
 
General Math Lesson 2
General Math Lesson 2General Math Lesson 2
General Math Lesson 2
 
Differential Geometry for Machine Learning
Differential Geometry for Machine LearningDifferential Geometry for Machine Learning
Differential Geometry for Machine Learning
 
Do you know the line
Do you know the lineDo you know the line
Do you know the line
 
The derivatives module03
The derivatives module03The derivatives module03
The derivatives module03
 
Ejercicios propuestos 3 Estructuras Discretas II Verónica Torres
Ejercicios propuestos 3 Estructuras Discretas II Verónica Torres Ejercicios propuestos 3 Estructuras Discretas II Verónica Torres
Ejercicios propuestos 3 Estructuras Discretas II Verónica Torres
 
Module03 the mean and standard deviation of random variable
Module03 the mean and standard deviation of random variableModule03 the mean and standard deviation of random variable
Module03 the mean and standard deviation of random variable
 
Jordan Higher (𝜎, 𝜏)-Centralizer on Prime Ring
Jordan Higher (𝜎, 𝜏)-Centralizer on Prime RingJordan Higher (𝜎, 𝜏)-Centralizer on Prime Ring
Jordan Higher (𝜎, 𝜏)-Centralizer on Prime Ring
 
Joint and Combined Variation (Mathematics 9)
Joint and Combined Variation (Mathematics 9)Joint and Combined Variation (Mathematics 9)
Joint and Combined Variation (Mathematics 9)
 
General Math Lesson 3
General Math Lesson 3General Math Lesson 3
General Math Lesson 3
 
Limit of complex number
Limit of complex numberLimit of complex number
Limit of complex number
 
Direct Variation (Mathematics 9)
Direct Variation (Mathematics 9)Direct Variation (Mathematics 9)
Direct Variation (Mathematics 9)
 
Least Square Plane and Leastsquare Quadric Surface Approximation by Using Mod...
Least Square Plane and Leastsquare Quadric Surface Approximation by Using Mod...Least Square Plane and Leastsquare Quadric Surface Approximation by Using Mod...
Least Square Plane and Leastsquare Quadric Surface Approximation by Using Mod...
 
Data Smashing
Data SmashingData Smashing
Data Smashing
 
SUEC 高中 Adv Maths (Trigo Function Part 3)
SUEC 高中 Adv Maths (Trigo Function Part 3)SUEC 高中 Adv Maths (Trigo Function Part 3)
SUEC 高中 Adv Maths (Trigo Function Part 3)
 
Unit 4 numericals on power screws 2
Unit  4 numericals on power screws 2Unit  4 numericals on power screws 2
Unit 4 numericals on power screws 2
 
Slides ineq-4
Slides ineq-4Slides ineq-4
Slides ineq-4
 
Paul Bleau Calc III Project 2 - Basel Problem
Paul Bleau Calc III Project 2 - Basel ProblemPaul Bleau Calc III Project 2 - Basel Problem
Paul Bleau Calc III Project 2 - Basel Problem
 
Stability criterion of periodic oscillations in a (14)
Stability criterion of periodic oscillations in a (14)Stability criterion of periodic oscillations in a (14)
Stability criterion of periodic oscillations in a (14)
 

Recently uploaded

Pteris : features, anatomy, morphology and lifecycle
Pteris : features, anatomy, morphology and lifecyclePteris : features, anatomy, morphology and lifecycle
Pteris : features, anatomy, morphology and lifecycleCherry
 
The Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptxThe Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptxseri bangash
 
Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.Cherry
 
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIA
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIACURRENT SCENARIO OF POULTRY PRODUCTION IN INDIA
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIADr. TATHAGAT KHOBRAGADE
 
Genome Projects : Human, Rice,Wheat,E coli and Arabidopsis.
Genome Projects : Human, Rice,Wheat,E coli and Arabidopsis.Genome Projects : Human, Rice,Wheat,E coli and Arabidopsis.
Genome Projects : Human, Rice,Wheat,E coli and Arabidopsis.Cherry
 
Cot curve, melting temperature, unique and repetitive DNA
Cot curve, melting temperature, unique and repetitive DNACot curve, melting temperature, unique and repetitive DNA
Cot curve, melting temperature, unique and repetitive DNACherry
 
Digital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptxDigital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptxMohamedFarag457087
 
Kanchipuram Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Kanchipuram Escorts 🥰 8617370543 Call Girls Offer VIP Hot GirlsKanchipuram Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Kanchipuram Escorts 🥰 8617370543 Call Girls Offer VIP Hot GirlsDeepika Singh
 
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptxClimate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptxDiariAli
 
GBSN - Biochemistry (Unit 2) Basic concept of organic chemistry
GBSN - Biochemistry (Unit 2) Basic concept of organic chemistry GBSN - Biochemistry (Unit 2) Basic concept of organic chemistry
GBSN - Biochemistry (Unit 2) Basic concept of organic chemistry Areesha Ahmad
 
CYTOGENETIC MAP................ ppt.pptx
CYTOGENETIC MAP................ ppt.pptxCYTOGENETIC MAP................ ppt.pptx
CYTOGENETIC MAP................ ppt.pptxCherry
 
Genome sequencing,shotgun sequencing.pptx
Genome sequencing,shotgun sequencing.pptxGenome sequencing,shotgun sequencing.pptx
Genome sequencing,shotgun sequencing.pptxCherry
 
development of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virusdevelopment of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virusNazaninKarimi6
 
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....muralinath2
 
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRL
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRLGwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRL
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRLkantirani197
 
Terpineol and it's characterization pptx
Terpineol and it's characterization pptxTerpineol and it's characterization pptx
Terpineol and it's characterization pptxMuhammadRazzaq31
 
GBSN - Microbiology (Unit 3)Defense Mechanism of the body
GBSN - Microbiology (Unit 3)Defense Mechanism of the body GBSN - Microbiology (Unit 3)Defense Mechanism of the body
GBSN - Microbiology (Unit 3)Defense Mechanism of the body Areesha Ahmad
 

Recently uploaded (20)

Pteris : features, anatomy, morphology and lifecycle
Pteris : features, anatomy, morphology and lifecyclePteris : features, anatomy, morphology and lifecycle
Pteris : features, anatomy, morphology and lifecycle
 
The Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptxThe Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptx
 
Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.
 
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIA
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIACURRENT SCENARIO OF POULTRY PRODUCTION IN INDIA
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIA
 
Genome Projects : Human, Rice,Wheat,E coli and Arabidopsis.
Genome Projects : Human, Rice,Wheat,E coli and Arabidopsis.Genome Projects : Human, Rice,Wheat,E coli and Arabidopsis.
Genome Projects : Human, Rice,Wheat,E coli and Arabidopsis.
 
Cot curve, melting temperature, unique and repetitive DNA
Cot curve, melting temperature, unique and repetitive DNACot curve, melting temperature, unique and repetitive DNA
Cot curve, melting temperature, unique and repetitive DNA
 
BHUBANESHWAR ODIA CALL GIRL SEIRVEC ❣️ 72051//37929❣️ CALL GIRL IN ODIA HAND ...
BHUBANESHWAR ODIA CALL GIRL SEIRVEC ❣️ 72051//37929❣️ CALL GIRL IN ODIA HAND ...BHUBANESHWAR ODIA CALL GIRL SEIRVEC ❣️ 72051//37929❣️ CALL GIRL IN ODIA HAND ...
BHUBANESHWAR ODIA CALL GIRL SEIRVEC ❣️ 72051//37929❣️ CALL GIRL IN ODIA HAND ...
 
Digital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptxDigital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptx
 
Kanchipuram Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Kanchipuram Escorts 🥰 8617370543 Call Girls Offer VIP Hot GirlsKanchipuram Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Kanchipuram Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
 
Clean In Place(CIP).pptx .
Clean In Place(CIP).pptx                 .Clean In Place(CIP).pptx                 .
Clean In Place(CIP).pptx .
 
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptxClimate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
 
GBSN - Biochemistry (Unit 2) Basic concept of organic chemistry
GBSN - Biochemistry (Unit 2) Basic concept of organic chemistry GBSN - Biochemistry (Unit 2) Basic concept of organic chemistry
GBSN - Biochemistry (Unit 2) Basic concept of organic chemistry
 
CYTOGENETIC MAP................ ppt.pptx
CYTOGENETIC MAP................ ppt.pptxCYTOGENETIC MAP................ ppt.pptx
CYTOGENETIC MAP................ ppt.pptx
 
Genome sequencing,shotgun sequencing.pptx
Genome sequencing,shotgun sequencing.pptxGenome sequencing,shotgun sequencing.pptx
Genome sequencing,shotgun sequencing.pptx
 
development of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virusdevelopment of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virus
 
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
 
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRL
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRLGwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRL
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRL
 
Terpineol and it's characterization pptx
Terpineol and it's characterization pptxTerpineol and it's characterization pptx
Terpineol and it's characterization pptx
 
ABHISHEK ANTIBIOTICS PPT MICROBIOLOGY // USES OF ANTIOBIOTICS TYPES OF ANTIB...
ABHISHEK ANTIBIOTICS PPT MICROBIOLOGY  // USES OF ANTIOBIOTICS TYPES OF ANTIB...ABHISHEK ANTIBIOTICS PPT MICROBIOLOGY  // USES OF ANTIOBIOTICS TYPES OF ANTIB...
ABHISHEK ANTIBIOTICS PPT MICROBIOLOGY // USES OF ANTIOBIOTICS TYPES OF ANTIB...
 
GBSN - Microbiology (Unit 3)Defense Mechanism of the body
GBSN - Microbiology (Unit 3)Defense Mechanism of the body GBSN - Microbiology (Unit 3)Defense Mechanism of the body
GBSN - Microbiology (Unit 3)Defense Mechanism of the body
 

Least Squares Fitting

  • 3.
  • 4. Introduction  Least Square Methods (LSM) is probably the most popular technique in statistics for modelling.  With applications in fields as diverse as statistics, finance, medicines, economics & psychology.  Least squares is a way to use data to make quantitative predictions.
  • 5. History Gauss Legendre First published by Legendre in 1805’s paper ‘New Methods for Determination of the Orbits of Comets’. In 1809, Gauss published a memoir in which he mentioned that he had previously discovered LSM and it as early as 1795 in estimating the orbit of an asteroid. Both Gauss and Legendre used the method of least squares to understand the orbits of comets, based on inexact measurements of the comets’ previous locations.
  • 6. Curve Fitting  What is curve fitting?  capturing the trend in the data by assigning a single function across the entire range. For example… x y Approximate fitting of a straight line
  • 7. f(x) = ax + b For each line Interpolation x f(x)
  • 8. f(x) = ax + b For each line Curve Fitting f(x) = ax + b For entire range x f(x)
  • 9. The straight line, 𝒇 𝒙 = 𝒂𝒙 + 𝒃 should be fitted through the given points 𝒙 𝟏, 𝒚 𝟏 , … , (𝒙 𝒏, 𝒚 𝒏) so that the sum of the squares of the distances of those points from the straight line is minimum, where the distance is measured in the vertical direction (the y-direction).  The distance between the observed point and expected point is called ‘error’ or ‘residual’; 𝒆𝒊 = 𝒚𝒊 − 𝒇(𝒙𝒊) Least Squares Method  The ‘best’ line has minimum error between line and data points. x y 𝒙𝒊, 𝒚𝒊 𝒚𝒊 − 𝒂 − 𝒃𝒙𝒊 𝒂 + 𝒃𝒙𝒊 𝒚 = 𝒂 + 𝒃𝒙 𝒙𝒊
  • 10. x f(x) What makes a particular straight line a ‘good’ fit?
  • 11. (𝒙 𝟐, 𝒚 𝟐) (𝒙 𝟒, 𝒚 𝟒) (𝒙 𝟏, 𝒚 𝟏) (𝒙 𝟑, 𝒚 𝟑) (𝒙 𝟏, 𝒇(𝒙 𝟏) ) (𝒙 𝟐, 𝒇(𝒙 𝟐) ) (𝒙 𝟑, 𝒇(𝒙 𝟑) ) (𝒙 𝟒, 𝒇(𝒙 𝟒) ) x f(x) What makes a particular straight line a ‘good’ fit?
  • 12.  Minimize 𝜮𝒆𝒊 𝟐 𝑬 = 𝒊=𝟏 𝒏 𝒆𝒊 𝟐 = 𝒊=𝟏 𝒏 𝒚𝒊 − 𝒇(𝒙𝒊) 𝟐 = 𝒊=𝟏 𝒏 𝒚𝒊 − (𝒂𝒙𝒊 + 𝒃) 𝟐 E= 𝒚 𝟏 − (𝒂𝒙 𝟏 + 𝒃) 𝟐 + 𝒚 𝟐 − (𝒂𝒙 𝟐 + 𝒃) 𝟐 + ………. + 𝒚 𝒏 − (𝒂𝒙 𝒏 + 𝒃) 𝟐  This is called the least squares approach, since square of the error is minimized. How do we compute ‘a’ and ‘b’ after a definition of “good fit” is obtained?            N i ii baxyE 1 2Minimize
  • 13. Contd. ……computing ‘a’ and ‘b’ 𝝏𝑬 𝝏𝒂 = −𝟐 𝒊=𝟏 𝒏 𝒙𝒊 (𝒚𝒊 − 𝒂𝒙𝒊 − 𝒃) = 0 𝝏𝑬 𝝏𝒃 = −𝟐 𝒊=𝟏 𝒏 (𝒚𝒊 − 𝒂𝒙𝒊 − 𝒃) = 0 Normal Equations 𝒂 𝒊=𝟏 𝒏 𝒙𝒊 𝟐 + 𝒃 𝒊=𝟏 𝒏 𝒙𝒊 = 𝒊=𝟏 𝒏 𝒙𝒊 𝒚𝒊 𝒂 𝒊=𝟏 𝒏 𝒙𝒊 + 𝒃 𝒏 = 𝒊=𝟏 𝒏 𝒚𝒊 Put these into matrix form 𝒏 𝒊=𝟏 𝒏 𝒙𝒊 𝒊=𝟏 𝒏 𝒙𝒊 𝒊=𝟏 𝒏 𝒙𝒊 𝟐 𝒃 𝒂 = 𝒊=𝟏 𝒏 𝒚𝒊 𝒊=𝟏 𝒏 𝒙𝒊 𝒚𝒊 𝑨𝑿 = 𝑩 Coefficients a and b can be obtained by solving 𝑿 = 𝑨−𝟏 ∗ 𝑩 𝒂 = 𝒏 𝒊=𝟏 𝒏 𝒙𝒊 𝒚𝒊 − 𝒊=𝟏 𝒏 𝒙𝒊 𝒊=𝟏 𝒏 𝒚𝒊 𝒏 𝒊=𝟏 𝒏 𝒙𝒊 𝟐 − 𝒊=𝟏 𝒏 𝒙𝒊 𝟐 𝒃 = 𝒊=𝟏 𝒏 𝒚𝒊 𝒊=𝟏 𝒏 𝒙𝒊 𝟐 − 𝒊=𝟏 𝒏 𝒙𝒊 𝒊=𝟏 𝒏 𝒙𝒊 𝒚𝒊 𝒏 𝒊=𝟏 𝒏 𝒙𝒊 𝟐 − 𝒊=𝟏 𝒏 𝒙𝒊 𝟐
  • 14. 0 1 2 3 4 5 6 7 x 12 10 8 6 4 2 0 -2 y What is “Good Fit”? 𝒇(𝒙) = 𝒄 𝟏 𝒙 + 𝒄 𝟐 𝒙 𝒇 𝒙 = 𝒄 𝟏 𝒙 𝟐 + 𝒄 𝟐 𝒙 + 𝒄 𝟑
  • 15. The Least-Squares mth Degree Polynomials  Using a polynomial of degree m 𝒚 = 𝒂 𝟎 + 𝒂 𝟏 𝒙 + 𝒂 𝟐 𝒙 𝟐 + ⋯ + 𝒂 𝒎 𝒙 𝒎  To approx. given set of data 𝒙 𝟏, 𝒚 𝟏 , 𝒙 𝟐, 𝒚 𝟐 , … , (𝒙 𝒏, 𝒚 𝒏) where 𝒎 ≤ 𝒏 − 𝟏, the best fitting curve has the least square error, i.e., 𝑴𝒊𝒏𝒊𝒎𝒊𝒛𝒆{𝑬 = 𝒊=𝟏 𝒏 {𝒚𝒊 − 𝒇(𝒙𝒊)} 𝟐 } 𝑬 = 𝒊=𝟏 𝒏 {𝒚𝒊 − 𝒂 𝟎 + 𝒂 𝟏 𝒙𝒊 + 𝒂 𝟐 𝒙𝒊 𝟐 + ⋯ + 𝒂 𝒎 𝒙𝒊 𝒎 } 𝟐  Obtain normal equations 𝝏𝑬 𝝏𝒂 𝟎 = 𝟎, 𝝏𝑬 𝝏𝒂 𝟏 = 𝟎, … . , 𝝏𝑬 𝝏𝒂 𝒎 = 𝟎  The normal equations can be put in matrix form 𝑨𝑿 = 𝑩 which can be solved to get 𝑿 = 𝑨−𝟏 ∗ B
  • 16. Fitting a Second Degree (Parabola) Polynomial  Parabolic Trend is given by 𝒚 = 𝒂 𝟎 + 𝒂 𝟏 𝒙 + 𝒂 𝟐 𝒙 𝟐  Then error is; 𝑬 = (𝒚 − (𝒂 𝟎+𝒂 𝟏 𝒙 + 𝒂 𝟐 𝒙 𝟐)) 𝟐  Minimizing  𝝏𝑬 𝝏𝒂 𝟎 = 𝟎 = −𝟐 (𝒚 − 𝒂 𝟎 + 𝒂 𝟏 𝒙 + 𝒂 𝟐 𝒙 𝟐 )  𝝏𝑬 𝝏𝒂 𝟏 = 𝟎 = −𝟐 𝒙(𝒚 − 𝒂 𝟎 + 𝒂 𝟏 𝒙 + 𝒂 𝟐 𝒙 𝟐)  𝝏𝑬 𝝏𝒂 𝟐 = 𝟎 = −𝟐 𝒙 𝟐(𝒚 − 𝒂 𝟎 + 𝒂 𝟏 𝒙 + 𝒂 𝟐 𝒙 𝟐)  Normal equations are  𝒚 = 𝒏𝒂 𝟎 + 𝒂 𝟏 𝒕 + 𝒂 𝟐 𝒙 𝟐  𝒙𝒚 = 𝒂 𝟎 𝒙 + 𝒂 𝟏 𝒙 𝟐 + 𝒂 𝟐 𝒙 𝟑  𝒙 𝟐 𝒚 = 𝒂 𝟎 𝒙 𝟐 + 𝒂 𝟏 𝒙 𝟑 + 𝒂 𝟑 𝒙 𝟒
  • 18. Limitations  Most serious limitation: The determination of the type of the trend curve to be fitted, whether we should fit a linear or a parabolic trend or some other more complicated trend curve.  The addition of single new observation necessitates all the calculations to be done afresh.  This method requires more calculations and quite tedious and time consuming as compared with other methods.
  • 19.  If P is the pull required to pull the load W by means of a pulley block, find a linear law of the form P=mW+ c connecting P and W (in kg.wt), using the following data Compute P when W=150 kg.wt  Sol- The corresponding normal Equations are 𝑃 = 4𝑐 + 𝑚 𝑊 ; 𝑊𝑃 = 𝑐 𝑊 + 𝑚 𝑊2 P= 12 15 21 25 W=50 70 100 120 W P W² WP 50 70 100 120 12 15 21 25 2500 4900 10000 14400 600 1050 2100 3000 Total =340 73 31800 6750 Example
  • 20.  Substituting the values 73 = 4c + 340m ; 6750 = 340c + 31800m Example contd…  With little algebra, we get m = 0.1879 & c = 2.2785 Hence the line if best fit is P = 2.2759 + 0.1879 W When W= 150 kg, P= 2.2785 + 0.1879 X 150 = 30.4635 0 5 10 15 20 25 30 0 50 100 150 P W P vs W P 0 5 10 15 20 25 30 0 50 100 150 P W P vs W P(expected)
  • 21. References  https://priceonomics.com/the-discovery-of-statistical-regression/  http://web.iitd.ac.in/~pmvs/courses/mel705/curvefitting.pdf  Least Squares Fitting of Data to a Curve/ Gerald Recktenwald/ Portland State University/ Department of Mechanical Engineering  Fundamentals of Statistics, S.C. Gupta  Higher Engineering Methods, Dr. B.S. Grewal  Advanced Engineering Method, ERWIN KREYSZIG  http://mathworld.wolfram.com/LeastSquaresFittingLogarithmic.htm l  http://mathworld.wolfram.com/LeastSquaresFittingExponential.html  http://mathworld.wolfram.com/LeastSquaresFittingPowerLaw.html