CE324 Lecture 7
CE324 Lecture 7
Metran
Licensed Geodetic Engineer
Geodetic Engineering Department
College of Engineering and Architecture
CE324 Module 7
CURVE FITTING
- LEAST-SQUARES REGRESSION
CURVE FITTING
• It is the method of constructing a curve or a derived function that will “fit” to
the set of data subject to constraints to obtain intermediate estimates.
Least-squares regression
Interpolation
CURVE FITTING
Trend Analysis
Hypothesis testing
• Mathematical backgrounds:
Linear Regression
Polynomial Regression
Multiple Linear Regression
LEAST-SQUARES REGRESSION
• Linear Regression
• Fitting a straight line to a set of data points predicted by a mathematical expression of
𝑦 = 𝑎0 + 𝑎1 𝑥
𝑛 𝑛
𝑎0 𝑛 + 𝑎1 𝑥𝑖 = 𝑦𝑖
𝑖=1 𝑖=1
𝑛 𝑛 𝑛
𝑎0 𝑥𝑖 + 𝑎1 𝑥𝑖2 = 𝑥𝑖 𝑦𝑖
𝑖=1 𝑖=1 𝑖=1
LEAST-SQUARES REGRESSION
• Linear regression coefficient formulas:
𝑛 𝑛 𝑛
𝑛 𝑖=1 𝑥𝑖 𝑦𝑖 − 𝑖=1 𝑥𝑖 𝑖=1 𝑦𝑖
𝑎1 = 2
𝑛 2 𝑛
𝑛 𝑥
𝑖=1 𝑖 − 𝑖=1 𝑥𝑖
𝑛 𝑛
𝑖=1 𝑦𝑖 − 𝑎1 𝑖=1 𝑥𝑖
𝑎0 =
𝑛
LEAST-SQUARES REGRESSION
• Polynomial Regression
Fitting set of data points to a higher-order polynomial function predicted by
mathematical expression (where “m” is the order of the polynomial) of
𝑦 = 𝑎0 + 𝑎1 𝑥 + 𝑎2 𝑥 2 + ⋯ + 𝑎𝑚 𝑥 𝑚
𝑦 = 𝑎0 + 𝑎1 𝑥 + 𝑎2 𝑥 2
𝑛 𝑛 𝑛
𝑎0 𝑛 + 𝑎1 𝑥𝑖 + 𝑎2 𝑥𝑖2 = 𝑦𝑖
𝑖=1 𝑖=1 𝑖=1
𝑛 𝑛 𝑛 𝑛
𝑎0 𝑥𝑖 + 𝑎1 𝑥𝑖2 + 𝑎2 𝑥𝑖3 = 𝑥𝑖 𝑦𝑖
𝑖=1 𝑖=1 𝑖=1 𝑖=1
𝑛 𝑛 𝑛 𝑛
Fitting the set of data points to a linear function of two or more independent variables
predicted by a mathematical expression of
𝑦 = 𝑎0 + 𝑎1 𝑥1 + 𝑎2 𝑥2 + ⋯ + 𝑎𝑚 𝑥𝑚
𝑦 = 𝑎0 + 𝑎1 𝑥1 + 𝑎2 𝑥2
𝑛 𝑛 𝑛
𝑎0 𝑛 + 𝑎1 𝑥1𝑖 + 𝑎2 𝑥2𝑖 = 𝑦𝑖
𝑖=1 𝑖=1 𝑖=1
𝑛 𝑛 𝑛 𝑛
2
𝑎0 𝑥1𝑖 + 𝑎1 𝑥1𝑖 + 𝑎2 𝑥1𝑖 𝑥2𝑖 = 𝑥1𝑖 𝑦𝑖
𝑖=1 𝑖=1 𝑖=1 𝑖=1
𝑛 𝑛 𝑛 𝑛
2
𝑎0 𝑥2𝑖 + 𝑎1 𝑥1𝑖 𝑥2𝑖 + 𝑎2 𝑥2𝑖 = 𝑥2𝑖 𝑦𝑖
𝑖=1 𝑖=1 𝑖=1 𝑖=1
LEAST-SQUARES REGRESSION
• EXAMPLE 1: Fit a straight line to the points in the given table
x 1 2 3 4 5 6 7
y 0.5 2.5 2 4 3.5 6 5.5
LEAST-SQUARES REGRESSION
• EXAMPLE 2: Fit a second-order polynomial to the points in the given table
x 0 1 2 3 4 5
y 2.1 7.7 13.6 27.2 40.9 61.1
LEAST-SQUARES REGRESSION
• EXAMPLE 3: Fit a function of two independent variables to the points in the
given table:
𝑥1 0 2 2.5 1 4 7
𝑥2 0 1 2 3 6 2
𝑦 5 10 9 0 3 27
THANK YOU