SlideShare a Scribd company logo
Mr. T. Mayooran,
Department of Interdisciplinary Studies,
Faculty of Engineering,
University of Jaffna.
Email: mayooran@eng.jfn.ac.lk
Mathematics - MC1020
Curve Fitting
CURVE FITTING
Describes techniques to fit curves (curve fitting) to discrete data to
obtain intermediate estimates.
There are two general approaches for curve fitting:
• Least Squares 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.
Thursday, January 24, 2019 2MC1020-MathematicsMC1020-Mathematics
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.
Thursday, January 24, 2019 MC1020-Mathematics 3
Thursday, January 24, 2019 MC1020-Mathematics 4
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.
ni
n
y
y i
,,1, 

 

 2
)(,
1
yyS
n
S
S it
t
y
Thursday, January 24, 2019 MC1020-Mathematics 5
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
nyy
S ii
y
1
)( 2
2




n
yy
S i
y
%100..
y
S
vc
y

Thursday, January 24, 2019 MC1020-Mathematics 6
Linear Regression
Thursday, January 24, 2019 MC1020-Mathematics 7
•Fitting a straight line to a set of paired
observations: (x1, y1), (x2, y2),…,(xn, yn)
yi = a0 + a1 xi + e
Where,
e = yi - a0 - a1 xi
a1 : slope
a0 : intercept
yi : measured value
e : error
Linear Regression: Residual
Thursday, January 24, 2019 MC1020-Mathematics 8
e Error
Line equation
y = a0 + a1 x
How to find a0 and
a1 so that the error
would be
minimum?
Thursday, January 24, 2019 MC1020-Mathematics 9
• Minimize the sum of the residual errors
for all available data?
Inadequate!
(see )
• Sum of the absolute values?
Inadequate!
(see )
• How about minimizing the distance that
an individual point falls from the line?
This does not work either! see 
 

n
i
ioi
n
i
i xaaye
1
1
1
)(
 

n
i
ii
n
i
i xaaye
1
10
1
Regression
line
Choosing Criteria For a “Best Fit”
Thursday, January 24, 2019 MC1020-Mathematics 10
11
• 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
iir
n
i
modelimeasuredi
n
i
ir
xaayS
yy
eS
1
2
10
1
2
1
2
)(
)( ,,
e Error
Thursday, January 24, 2019 MC1020-Mathematics
Linear Regression: Least Squares Fit
 

n
i
ii
n
i
ir xaayeS
1
2
10
1
2
)(min
   

n
i
n
i
iiii
n
i
ir xaayyyeS
1 1
2
10
2
1
2
)()model,measured,(
Yields a unique line for a given set of data.
Thursday, January 24, 2019 MC1020-Mathematics 12
Linear Regression: Least Squares Fit
 

n
i
ii
n
i
ir xaayeS
1
2
10
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
Thursday, January 24, 2019 MC1020-Mathematics 13
 
 
 










2
10
10
1
1
1
0
0
0)(2
0)(2
iiii
ii
iioi
r
ioi
o
r
xaxaxy
xaay
xxaay
a
S
xaay
a
S
Linear Regression:
Determination of ao and a1
 
 





2
10
10
00
iiii
ii
xaxaxy
yaxna
naa
2 equations with 2
unknowns, can be
solved simultaneously
Thursday, January 24, 2019 MC1020-Mathematics 14
Linear Regression:
Determination of ao and a1
  
  


 221
ii
iiii
xxn
yxyxn
a
xaya 10 
Thursday, January 24, 2019 MC1020-Mathematics 15
Thursday, January 24, 2019 MC1020-Mathematics 16
You can view/download
this whole slides from
following path:
Go to www.slideshare.net
Search MC1020
Thursday, January 24, 2019 MC1020-Mathematics 17
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
Thursday, January 24, 2019 MC1020-Mathematics 18


n
i
it yyS
1
2
)(
2
n
1i
i1oi
n
1i
2
ir xaayeS )( 

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
SS
r

2
r2: coefficient of determination
r : correlation coefficient
Thursday, January 24, 2019 MC1020-Mathematics 19
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.
Thursday, January 24, 2019 MC1020-Mathematics 20
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
4285.3
7
24
4
7
28
 yx
428571.3
7
24
4
7
28
 yx
xi yi xiyi xi
2
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
Thursday, January 24, 2019 MC1020-Mathematics 21
Least Squares Fit of a Straight Line:
Example (cont’d)
07142857.048392857.0428571.3
8392857.0
281407
24285.1197
)(
10
2
221









 
  
xaya
xxn
yxyxn
a
ii
iiii
Y = 0.07142857 + 0.8392857 x
Thursday, January 24, 2019 MC1020-Mathematics 22
Least Squares Fit of a Straight Line:
Example (Error Analysis)
9911.2
2
  ir eS
932.0868.02
 rr
xi yi
1 0.5
2 2.5
3 2.0
4 4.0
5 3.5
6 6.0
7 5.5
8.5765 0.1687
0.8622 0.5625
2.0408 0.3473
0.3265 0.3265
0.0051 0.5896
6.6122 0.7972
4.2908 0.1993
2
^
22
)( yye)y(y iii 
28 24.0 22.7143 2.9911
868.02



t
rt
S
SS
r
  7143.22
2
  yyS it
Thursday, January 24, 2019 MC1020-Mathematics 23
Least Squares Fit of a Straight
Line: Example (Error Analysis)
9457.1
17
7143.22
1





n
S
s t
y
7735.0
27
9911.2
2
/ 




n
S
s 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
Thursday, January 24, 2019 MC1020-Mathematics 24
Algorithm for linear regression
Thursday, January 24, 2019 MC1020-Mathematics 25
Regress(x,y,n,a1,a0,sxy,r2)
sumx=0; sumxy=0; st=0
sumy=0;sumx2=0; sr=0
DO i=1,n
sumx=sumx+xi
sumy=sumy+yi
sumxy=sumxy+xi*yi
sumx2=sumx2+xi*yi
END DO
xm=sumx/n
ym=sumy/n
a1=(n*sumxy-sumx*sumy)/(n*sumx2-sumx*sumx)
a0=ym-a1*xm
DO i=1,n
st=st+(yi-ym)^2
sr=sr+(yi-a1*xi-a0)^2
END DO
syx=(sr/(n-2))^0.5
r2=(st-sr)/st
END Regress
Matlab code for linear regression
Thursday, January 24, 2019 MC1020-Mathematics 26
function [y0, a0, a1, r2, r, k2] = lin_reg(x, y, x0)
% Number of known points
n = length(x);
% Initialization
j = 0; k = 0; l = 0; m = 0; r2 = 0;
% Accumulate intermediate sums
j = sum(x); k = sum(y);
l = sum(x.^2); m = sum(y.^2); r2 = sum(x.*y);
% Compute curve coefficients
a1 = (n*r2 - k*j)/(n*l - j^2); a0 = (k - a1*j)/n;
% Compute regression analysis
j = a1*(r2 - j*k/n);
m = m - k^2/n; k = m - j;
% Coefficient of determination
r2 = j/m;r = sqrt(r2);
% Std. error of estimate
k2 = sqrt(k/(n-2));
% Interpolation value
y0 = a0 + a1*x0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[y0, a0, a1, r2, r, k2] = lin_reg(x, y, x0)
[y0] = lin_reg(x, y, x0)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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.
Thursday, January 24, 2019 MC1020-Mathematics 27
Thursday, January 24, 2019 MC1020-Mathematics 28
Linearization of Nonlinear Relationships
1. The exponential equation.
 xb
eay 1
1
xbay 11lnln 
y* = ao + a1 x
Thursday, January 24, 2019 MC1020-Mathematics 29
Linearization of Nonlinear Relationships
2. The power equation
 2
2
b
xay
xbay logloglog 22 
y* = ao + a1 x*Thursday, January 24, 2019 MC1020-Mathematics 30
Linearization of Nonlinear Relationships
3. The saturation-growth-rate equation



xb
x
ay
3
3







xa
b
ay
111
3
3
3
y* = 1/y
ao = 1/a3
a1 = b3/a3
x* = 1/x
Thursday, January 24, 2019 MC1020-Mathematics 31
Example
Fit the following Equation:
2
2
b
xay 
to the data in the following table:
xi yi
1 0.5
2 1.7
3 3.4
4 5.7
5 8.4
15 19.7
X*=log xi Y*=logyi
0 -0.301
0.301 0.226
0.477 0.534
0.602 0.753
0.699 0.922
2.079 2.141
)log(log 2
2
b
xay 
2120
**
log
logloglet
b, aaa
x,y, XY


xbay logloglog 22 
*
10
*
XaaY 
Thursday, January 24, 2019 MC1020-Mathematics 32
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.4886
Sum 15 19.700 2.079 2.141 1.424 1.169
1 2 22
0 1
5 1.424 2.079 2.141
1.75
5 1.169 2.079( )
0.4282 1.75 0.41584 0.334
i i i i
i i
n x y x y
a
n x x
a y a x
    
  
 

      
  
 
Thursday, January 24, 2019 MC1020-Mathematics 33
Linearization of Nonlinear
Functions: Example
log y = -0.334+1.75log x
1.75
0.46y x
Thursday, January 24, 2019 MC1020-Mathematics 34
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.
Thursday, January 24, 2019 MC1020-Mathematics 35
Polynomial Regression (cont’d)
A parabola is preferable
Thursday, January 24, 2019 MC1020-Mathematics 36
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  2
21
2
21 iioii xaxaaye 
  
22
21
2
iioiir xaxaayeS
Thursday, January 24, 2019 MC1020-Mathematics 37
Polynomial Regression (cont’d)
0xxaxaay2
a
S
0xxaxaay2
a
S
0xaxaay2
a
S
2
i
2
i2i1oi
2
r
i
2
i2i1oi
1
r
2
i2i1oi
o
r












)(
)(
)(
 
 




4
i2
3
i1
2
ioi
2
i
3
i2
2
i1ioii
2
i2i1oi
xaxaxayx
xaxaxayx
xaxaany 3 linear equations
with 3 unknowns
(ao,a1,a2), can be
solved
Thursday, January 24, 2019 MC1020-Mathematics 38
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
S
s r
xy t
rt
S
SS
r

2





































ii
ii
i
iii
iii
ii
yx
yx
y
a
a
a
xxx
xxx
xxn
2
2
1
0
432
32
2
*
Thursday, January 24, 2019 MC1020-Mathematics 39
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 m
mo  .....2
21
 1
/


mn
S
s r
xy
t
rt
S
SS
r

2
Thursday, January 24, 2019 MC1020-Mathematics 40
Polynomial Regression- Example
Fit a second order polynomial to data:
2253
 ix
9794
 ix
xi yi xi
2 xi
3 xi
4 xiyi xi
2yi
0 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
433.25
6
6.152
,5.2
6
15
 yx 8.2488
2
 ii yx
Thursday, January 24, 2019 MC1020-Mathematics 41
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.3
2
  ir eS  39.2513
2
  yyS it
Thursday, January 24, 2019 MC1020-Mathematics 42
Polynomial Regression- Example
(cont’d)
xi yi ymodel ei
2 (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.1
36
74657.3
/ 

xys
99925.0,99851.0
39.2513
74657.339.2513 22


 rrr
Thursday, January 24, 2019 MC1020-Mathematics 43
Thursday, January 24, 2019 MC1020-Mathematics 44
Learning outcomes
Draw sketch graphs of standard curves
Fit graphs to data using straight-line forms
Fit graphs to data using the method of least
squares
Calculate measures of correlation
Practice Example 1
Thursday, January 24, 2019 MC1020-Mathematics 45
As machines are used over long periods of time, the
output product can get off target. Below is the
average value of how much off target a product is
getting manufactured as a function of machine use.
Table : Off target value as a function of machine
use.
Regress the data to ℎ = 𝑎0 + 𝑎1 𝑡. Find the amount
of off target after 50 hours of operation.
30 33 34 35 39 44 45
1.10 1.21 1.25 1.23 1.30 1.40 1.42
Thursday, January 24, 2019 MC1020-Mathematics 46
We will discuss some
additional Examples in
Tutorial session….

More Related Content

What's hot

Class8 calculus ii
Class8 calculus iiClass8 calculus ii
Class8 calculus ii
JOSUE DEL AGUILA RIOS
 
Đề Thi HK2 Toán 8 - THCS Tôn Thất Tùng
Đề Thi HK2 Toán 8 - THCS Tôn Thất TùngĐề Thi HK2 Toán 8 - THCS Tôn Thất Tùng
Đề Thi HK2 Toán 8 - THCS Tôn Thất Tùng
Công Ty TNHH VIETTRIGROUP
 
Mathematics TAKS Exit Level Review
Mathematics TAKS Exit Level ReviewMathematics TAKS Exit Level Review
Mathematics TAKS Exit Level Review
guest3f17823
 
Higher papers 2007 - 2013
Higher papers 2007 -  2013Higher papers 2007 -  2013
Higher papers 2007 - 2013
sjamaths
 
Methods for solving quadratic equations
Methods for solving quadratic equationsMethods for solving quadratic equations
Methods for solving quadratic equations
Wenslette Rosique
 
Final matrix ppt
Final matrix pptFinal matrix ppt
Final matrix ppt
Rohan Chawla
 
Activity 02
Activity 02Activity 02
Time series statastics
Time series statasticsTime series statastics
Time series statastics
Channappa Mudagal
 
Graphing Linear Equations Teacher Lecture
Graphing Linear Equations Teacher LectureGraphing Linear Equations Teacher Lecture
Graphing Linear Equations Teacher Lecture
Adam Jackson
 
Graphing Linear Equations Lesson
Graphing Linear Equations LessonGraphing Linear Equations Lesson
Graphing Linear Equations Lesson
bslkmljsl
 
Graph of linear equations
Graph of linear equationsGraph of linear equations
Graph of linear equations
anettebasco
 
Graphing Absolute Value Functions
Graphing Absolute Value FunctionsGraphing Absolute Value Functions
Graphing Absolute Value Functions
ms.stedman
 
H 2004 2007
H 2004   2007H 2004   2007
H 2004 2007
sjamaths
 
Đề Thi HK2 Toán 7 - THCS Lý Thánh Tông
Đề Thi HK2 Toán 7 - THCS Lý Thánh TôngĐề Thi HK2 Toán 7 - THCS Lý Thánh Tông
Đề Thi HK2 Toán 7 - THCS Lý Thánh Tông
Trung Tâm Gia Sư Việt Trí
 
Ap Physics C Mathematical Concepts Vectors
Ap Physics C Mathematical Concepts VectorsAp Physics C Mathematical Concepts Vectors
Ap Physics C Mathematical Concepts Vectors
James Birrell
 
QRB 501 Final Exam 2015 version
QRB 501 Final Exam 2015 versionQRB 501 Final Exam 2015 version
QRB 501 Final Exam 2015 version
uopcom4
 

What's hot (16)

Class8 calculus ii
Class8 calculus iiClass8 calculus ii
Class8 calculus ii
 
Đề Thi HK2 Toán 8 - THCS Tôn Thất Tùng
Đề Thi HK2 Toán 8 - THCS Tôn Thất TùngĐề Thi HK2 Toán 8 - THCS Tôn Thất Tùng
Đề Thi HK2 Toán 8 - THCS Tôn Thất Tùng
 
Mathematics TAKS Exit Level Review
Mathematics TAKS Exit Level ReviewMathematics TAKS Exit Level Review
Mathematics TAKS Exit Level Review
 
Higher papers 2007 - 2013
Higher papers 2007 -  2013Higher papers 2007 -  2013
Higher papers 2007 - 2013
 
Methods for solving quadratic equations
Methods for solving quadratic equationsMethods for solving quadratic equations
Methods for solving quadratic equations
 
Final matrix ppt
Final matrix pptFinal matrix ppt
Final matrix ppt
 
Activity 02
Activity 02Activity 02
Activity 02
 
Time series statastics
Time series statasticsTime series statastics
Time series statastics
 
Graphing Linear Equations Teacher Lecture
Graphing Linear Equations Teacher LectureGraphing Linear Equations Teacher Lecture
Graphing Linear Equations Teacher Lecture
 
Graphing Linear Equations Lesson
Graphing Linear Equations LessonGraphing Linear Equations Lesson
Graphing Linear Equations Lesson
 
Graph of linear equations
Graph of linear equationsGraph of linear equations
Graph of linear equations
 
Graphing Absolute Value Functions
Graphing Absolute Value FunctionsGraphing Absolute Value Functions
Graphing Absolute Value Functions
 
H 2004 2007
H 2004   2007H 2004   2007
H 2004 2007
 
Đề Thi HK2 Toán 7 - THCS Lý Thánh Tông
Đề Thi HK2 Toán 7 - THCS Lý Thánh TôngĐề Thi HK2 Toán 7 - THCS Lý Thánh Tông
Đề Thi HK2 Toán 7 - THCS Lý Thánh Tông
 
Ap Physics C Mathematical Concepts Vectors
Ap Physics C Mathematical Concepts VectorsAp Physics C Mathematical Concepts Vectors
Ap Physics C Mathematical Concepts Vectors
 
QRB 501 Final Exam 2015 version
QRB 501 Final Exam 2015 versionQRB 501 Final Exam 2015 version
QRB 501 Final Exam 2015 version
 

Similar to Mc1020

Applied numerical methods lec8
Applied numerical methods lec8Applied numerical methods lec8
Applied numerical methods lec8
Yasser Ahmed
 
Curve fitting
Curve fitting Curve fitting
Curve fitting
shopnohinami
 
Examiner Analysis of 2014 ICSE Mathematics Board Paper
Examiner Analysis of 2014 ICSE Mathematics Board PaperExaminer Analysis of 2014 ICSE Mathematics Board Paper
Examiner Analysis of 2014 ICSE Mathematics Board Paper
Shivang Singh
 
Curve_Fitting.pdf
Curve_Fitting.pdfCurve_Fitting.pdf
Curve_Fitting.pdf
Irfan Khan
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
Nada Hikmah
 
Descriptive statistics
Descriptive statisticsDescriptive statistics
Descriptive statistics
University of Jaffna
 
assignment on business environment of abc
assignment on business environment of abcassignment on business environment of abc
assignment on business environment of abc
MdJahangirAlam877557
 
Regression
RegressionRegression
20 ms-me-amd-06 (simple linear regression)
20 ms-me-amd-06 (simple linear regression)20 ms-me-amd-06 (simple linear regression)
20 ms-me-amd-06 (simple linear regression)
HassanShah124
 
11.polynomial regression model of making cost prediction in mixed cost analysis
11.polynomial regression model of making cost prediction in mixed cost analysis11.polynomial regression model of making cost prediction in mixed cost analysis
11.polynomial regression model of making cost prediction in mixed cost analysis
Alexander Decker
 
Polynomial regression model of making cost prediction in mixed cost analysis
Polynomial regression model of making cost prediction in mixed cost analysisPolynomial regression model of making cost prediction in mixed cost analysis
Polynomial regression model of making cost prediction in mixed cost analysis
Alexander Decker
 
Basics of Regression analysis
 Basics of Regression analysis Basics of Regression analysis
Basics of Regression analysis
Mahak Vijayvargiya
 
Lecture2-LinearRegression.ppt
Lecture2-LinearRegression.pptLecture2-LinearRegression.ppt
Lecture2-LinearRegression.ppt
ssuser36911e
 
Kk2518251830
Kk2518251830Kk2518251830
Kk2518251830
IJERA Editor
 
Kk2518251830
Kk2518251830Kk2518251830
Kk2518251830
IJERA Editor
 
Lecture - 8 MLR.pptx
Lecture - 8 MLR.pptxLecture - 8 MLR.pptx
Lecture - 8 MLR.pptx
iris765749
 
STA003_WK2_L.pptx
STA003_WK2_L.pptxSTA003_WK2_L.pptx
STA003_WK2_L.pptx
MAmir23
 
Business statistics homework help
Business statistics homework helpBusiness statistics homework help
Business statistics homework help
Statistics Help Desk
 
B. SC CSIT Computer Graphics Unit1.2 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit1.2 By Tekendra Nath YogiB. SC CSIT Computer Graphics Unit1.2 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit1.2 By Tekendra Nath Yogi
Tekendra Nath Yogi
 
Business Mathematics in decision making
Business Mathematics in decision makingBusiness Mathematics in decision making
Business Mathematics in decision making
Fahad Fu
 

Similar to Mc1020 (20)

Applied numerical methods lec8
Applied numerical methods lec8Applied numerical methods lec8
Applied numerical methods lec8
 
Curve fitting
Curve fitting Curve fitting
Curve fitting
 
Examiner Analysis of 2014 ICSE Mathematics Board Paper
Examiner Analysis of 2014 ICSE Mathematics Board PaperExaminer Analysis of 2014 ICSE Mathematics Board Paper
Examiner Analysis of 2014 ICSE Mathematics Board Paper
 
Curve_Fitting.pdf
Curve_Fitting.pdfCurve_Fitting.pdf
Curve_Fitting.pdf
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
 
Descriptive statistics
Descriptive statisticsDescriptive statistics
Descriptive statistics
 
assignment on business environment of abc
assignment on business environment of abcassignment on business environment of abc
assignment on business environment of abc
 
Regression
RegressionRegression
Regression
 
20 ms-me-amd-06 (simple linear regression)
20 ms-me-amd-06 (simple linear regression)20 ms-me-amd-06 (simple linear regression)
20 ms-me-amd-06 (simple linear regression)
 
11.polynomial regression model of making cost prediction in mixed cost analysis
11.polynomial regression model of making cost prediction in mixed cost analysis11.polynomial regression model of making cost prediction in mixed cost analysis
11.polynomial regression model of making cost prediction in mixed cost analysis
 
Polynomial regression model of making cost prediction in mixed cost analysis
Polynomial regression model of making cost prediction in mixed cost analysisPolynomial regression model of making cost prediction in mixed cost analysis
Polynomial regression model of making cost prediction in mixed cost analysis
 
Basics of Regression analysis
 Basics of Regression analysis Basics of Regression analysis
Basics of Regression analysis
 
Lecture2-LinearRegression.ppt
Lecture2-LinearRegression.pptLecture2-LinearRegression.ppt
Lecture2-LinearRegression.ppt
 
Kk2518251830
Kk2518251830Kk2518251830
Kk2518251830
 
Kk2518251830
Kk2518251830Kk2518251830
Kk2518251830
 
Lecture - 8 MLR.pptx
Lecture - 8 MLR.pptxLecture - 8 MLR.pptx
Lecture - 8 MLR.pptx
 
STA003_WK2_L.pptx
STA003_WK2_L.pptxSTA003_WK2_L.pptx
STA003_WK2_L.pptx
 
Business statistics homework help
Business statistics homework helpBusiness statistics homework help
Business statistics homework help
 
B. SC CSIT Computer Graphics Unit1.2 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit1.2 By Tekendra Nath YogiB. SC CSIT Computer Graphics Unit1.2 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit1.2 By Tekendra Nath Yogi
 
Business Mathematics in decision making
Business Mathematics in decision makingBusiness Mathematics in decision making
Business Mathematics in decision making
 

Recently uploaded

Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
Celine George
 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
Iris Thiele Isip-Tan
 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
Mohammad Al-Dhahabi
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
indexPub
 
How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17
Celine George
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
TechSoup
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
khuleseema60
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
blueshagoo1
 

Recently uploaded (20)

Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
 
How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
 

Mc1020

  • 1. Mr. T. Mayooran, Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna. Email: mayooran@eng.jfn.ac.lk Mathematics - MC1020 Curve Fitting
  • 2. CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for curve fitting: • Least Squares 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. Thursday, January 24, 2019 2MC1020-MathematicsMC1020-Mathematics
  • 3. 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. Thursday, January 24, 2019 MC1020-Mathematics 3
  • 4. Thursday, January 24, 2019 MC1020-Mathematics 4
  • 5. 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. ni n y y i ,,1,       2 )(, 1 yyS n S S it t y Thursday, January 24, 2019 MC1020-Mathematics 5
  • 6. 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 nyy S ii y 1 )( 2 2     n yy S i y %100.. y S vc y  Thursday, January 24, 2019 MC1020-Mathematics 6
  • 7. Linear Regression Thursday, January 24, 2019 MC1020-Mathematics 7 •Fitting a straight line to a set of paired observations: (x1, y1), (x2, y2),…,(xn, yn) yi = a0 + a1 xi + e Where, e = yi - a0 - a1 xi a1 : slope a0 : intercept yi : measured value e : error
  • 8. Linear Regression: Residual Thursday, January 24, 2019 MC1020-Mathematics 8 e Error Line equation y = a0 + a1 x
  • 9. How to find a0 and a1 so that the error would be minimum? Thursday, January 24, 2019 MC1020-Mathematics 9
  • 10. • Minimize the sum of the residual errors for all available data? Inadequate! (see ) • Sum of the absolute values? Inadequate! (see ) • How about minimizing the distance that an individual point falls from the line? This does not work either! see     n i ioi n i i xaaye 1 1 1 )(    n i ii n i i xaaye 1 10 1 Regression line Choosing Criteria For a “Best Fit” Thursday, January 24, 2019 MC1020-Mathematics 10
  • 11. 11 • 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 iir n i modelimeasuredi n i ir xaayS yy eS 1 2 10 1 2 1 2 )( )( ,, e Error Thursday, January 24, 2019 MC1020-Mathematics
  • 12. Linear Regression: Least Squares Fit    n i ii n i ir xaayeS 1 2 10 1 2 )(min      n i n i iiii n i ir xaayyyeS 1 1 2 10 2 1 2 )()model,measured,( Yields a unique line for a given set of data. Thursday, January 24, 2019 MC1020-Mathematics 12
  • 13. Linear Regression: Least Squares Fit    n i ii n i ir xaayeS 1 2 10 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 Thursday, January 24, 2019 MC1020-Mathematics 13
  • 14.                 2 10 10 1 1 1 0 0 0)(2 0)(2 iiii ii iioi r ioi o r xaxaxy xaay xxaay a S xaay a S Linear Regression: Determination of ao and a1          2 10 10 00 iiii ii xaxaxy yaxna naa 2 equations with 2 unknowns, can be solved simultaneously Thursday, January 24, 2019 MC1020-Mathematics 14
  • 15. Linear Regression: Determination of ao and a1          221 ii iiii xxn yxyxn a xaya 10  Thursday, January 24, 2019 MC1020-Mathematics 15
  • 16. Thursday, January 24, 2019 MC1020-Mathematics 16 You can view/download this whole slides from following path: Go to www.slideshare.net Search MC1020
  • 17. Thursday, January 24, 2019 MC1020-Mathematics 17
  • 18. 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 Thursday, January 24, 2019 MC1020-Mathematics 18   n i it yyS 1 2 )( 2 n 1i i1oi n 1i 2 ir xaayeS )(  
  • 19. 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 SS r  2 r2: coefficient of determination r : correlation coefficient Thursday, January 24, 2019 MC1020-Mathematics 19
  • 20. 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. Thursday, January 24, 2019 MC1020-Mathematics 20
  • 21. 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 4285.3 7 24 4 7 28  yx 428571.3 7 24 4 7 28  yx xi yi xiyi xi 2 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 Thursday, January 24, 2019 MC1020-Mathematics 21
  • 22. Least Squares Fit of a Straight Line: Example (cont’d) 07142857.048392857.0428571.3 8392857.0 281407 24285.1197 )( 10 2 221               xaya xxn yxyxn a ii iiii Y = 0.07142857 + 0.8392857 x Thursday, January 24, 2019 MC1020-Mathematics 22
  • 23. Least Squares Fit of a Straight Line: Example (Error Analysis) 9911.2 2   ir eS 932.0868.02  rr xi yi 1 0.5 2 2.5 3 2.0 4 4.0 5 3.5 6 6.0 7 5.5 8.5765 0.1687 0.8622 0.5625 2.0408 0.3473 0.3265 0.3265 0.0051 0.5896 6.6122 0.7972 4.2908 0.1993 2 ^ 22 )( yye)y(y iii  28 24.0 22.7143 2.9911 868.02    t rt S SS r   7143.22 2   yyS it Thursday, January 24, 2019 MC1020-Mathematics 23
  • 24. Least Squares Fit of a Straight Line: Example (Error Analysis) 9457.1 17 7143.22 1      n S s t y 7735.0 27 9911.2 2 /      n S s 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 Thursday, January 24, 2019 MC1020-Mathematics 24
  • 25. Algorithm for linear regression Thursday, January 24, 2019 MC1020-Mathematics 25 Regress(x,y,n,a1,a0,sxy,r2) sumx=0; sumxy=0; st=0 sumy=0;sumx2=0; sr=0 DO i=1,n sumx=sumx+xi sumy=sumy+yi sumxy=sumxy+xi*yi sumx2=sumx2+xi*yi END DO xm=sumx/n ym=sumy/n a1=(n*sumxy-sumx*sumy)/(n*sumx2-sumx*sumx) a0=ym-a1*xm DO i=1,n st=st+(yi-ym)^2 sr=sr+(yi-a1*xi-a0)^2 END DO syx=(sr/(n-2))^0.5 r2=(st-sr)/st END Regress
  • 26. Matlab code for linear regression Thursday, January 24, 2019 MC1020-Mathematics 26 function [y0, a0, a1, r2, r, k2] = lin_reg(x, y, x0) % Number of known points n = length(x); % Initialization j = 0; k = 0; l = 0; m = 0; r2 = 0; % Accumulate intermediate sums j = sum(x); k = sum(y); l = sum(x.^2); m = sum(y.^2); r2 = sum(x.*y); % Compute curve coefficients a1 = (n*r2 - k*j)/(n*l - j^2); a0 = (k - a1*j)/n; % Compute regression analysis j = a1*(r2 - j*k/n); m = m - k^2/n; k = m - j; % Coefficient of determination r2 = j/m;r = sqrt(r2); % Std. error of estimate k2 = sqrt(k/(n-2)); % Interpolation value y0 = a0 + a1*x0; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% [y0, a0, a1, r2, r, k2] = lin_reg(x, y, x0) [y0] = lin_reg(x, y, x0) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  • 27. 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. Thursday, January 24, 2019 MC1020-Mathematics 27
  • 28. Thursday, January 24, 2019 MC1020-Mathematics 28
  • 29. Linearization of Nonlinear Relationships 1. The exponential equation.  xb eay 1 1 xbay 11lnln  y* = ao + a1 x Thursday, January 24, 2019 MC1020-Mathematics 29
  • 30. Linearization of Nonlinear Relationships 2. The power equation  2 2 b xay xbay logloglog 22  y* = ao + a1 x*Thursday, January 24, 2019 MC1020-Mathematics 30
  • 31. Linearization of Nonlinear Relationships 3. The saturation-growth-rate equation    xb x ay 3 3        xa b ay 111 3 3 3 y* = 1/y ao = 1/a3 a1 = b3/a3 x* = 1/x Thursday, January 24, 2019 MC1020-Mathematics 31
  • 32. Example Fit the following Equation: 2 2 b xay  to the data in the following table: xi yi 1 0.5 2 1.7 3 3.4 4 5.7 5 8.4 15 19.7 X*=log xi Y*=logyi 0 -0.301 0.301 0.226 0.477 0.534 0.602 0.753 0.699 0.922 2.079 2.141 )log(log 2 2 b xay  2120 ** log logloglet b, aaa x,y, XY   xbay logloglog 22  * 10 * XaaY  Thursday, January 24, 2019 MC1020-Mathematics 32
  • 33. 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.4886 Sum 15 19.700 2.079 2.141 1.424 1.169 1 2 22 0 1 5 1.424 2.079 2.141 1.75 5 1.169 2.079( ) 0.4282 1.75 0.41584 0.334 i i i i i i n x y x y a n x x a y a x                        Thursday, January 24, 2019 MC1020-Mathematics 33
  • 34. Linearization of Nonlinear Functions: Example log y = -0.334+1.75log x 1.75 0.46y x Thursday, January 24, 2019 MC1020-Mathematics 34
  • 35. 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. Thursday, January 24, 2019 MC1020-Mathematics 35
  • 36. Polynomial Regression (cont’d) A parabola is preferable Thursday, January 24, 2019 MC1020-Mathematics 36
  • 37. 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  2 21 2 21 iioii xaxaaye     22 21 2 iioiir xaxaayeS Thursday, January 24, 2019 MC1020-Mathematics 37
  • 38. Polynomial Regression (cont’d) 0xxaxaay2 a S 0xxaxaay2 a S 0xaxaay2 a S 2 i 2 i2i1oi 2 r i 2 i2i1oi 1 r 2 i2i1oi o r             )( )( )(         4 i2 3 i1 2 ioi 2 i 3 i2 2 i1ioii 2 i2i1oi xaxaxayx xaxaxayx xaxaany 3 linear equations with 3 unknowns (ao,a1,a2), can be solved Thursday, January 24, 2019 MC1020-Mathematics 38
  • 39. 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 S s r xy t rt S SS r  2                                      ii ii i iii iii ii yx yx y a a a xxx xxx xxn 2 2 1 0 432 32 2 * Thursday, January 24, 2019 MC1020-Mathematics 39
  • 40. 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 m mo  .....2 21  1 /   mn S s r xy t rt S SS r  2 Thursday, January 24, 2019 MC1020-Mathematics 40
  • 41. Polynomial Regression- Example Fit a second order polynomial to data: 2253  ix 9794  ix xi yi xi 2 xi 3 xi 4 xiyi xi 2yi 0 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 433.25 6 6.152 ,5.2 6 15  yx 8.2488 2  ii yx Thursday, January 24, 2019 MC1020-Mathematics 41
  • 42. 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.3 2   ir eS  39.2513 2   yyS it Thursday, January 24, 2019 MC1020-Mathematics 42
  • 43. Polynomial Regression- Example (cont’d) xi yi ymodel ei 2 (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.1 36 74657.3 /   xys 99925.0,99851.0 39.2513 74657.339.2513 22    rrr Thursday, January 24, 2019 MC1020-Mathematics 43
  • 44. Thursday, January 24, 2019 MC1020-Mathematics 44 Learning outcomes Draw sketch graphs of standard curves Fit graphs to data using straight-line forms Fit graphs to data using the method of least squares Calculate measures of correlation
  • 45. Practice Example 1 Thursday, January 24, 2019 MC1020-Mathematics 45 As machines are used over long periods of time, the output product can get off target. Below is the average value of how much off target a product is getting manufactured as a function of machine use. Table : Off target value as a function of machine use. Regress the data to ℎ = 𝑎0 + 𝑎1 𝑡. Find the amount of off target after 50 hours of operation. 30 33 34 35 39 44 45 1.10 1.21 1.25 1.23 1.30 1.40 1.42
  • 46. Thursday, January 24, 2019 MC1020-Mathematics 46 We will discuss some additional Examples in Tutorial session….