University of Palestine Gaza Strip Civil Engineering College Numerical Analysis CIVL 3309 Dr. Suhail Lubbad

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

University of Palestine

Gaza Strip

Civil Engineering College


Numerical analysis
CIVL 3309
Formerly CVL 3308

Dr. Suhail Lubbad


Least Square Regression
Curve fitting
Data Regression

Find a simple yet the best curve that fits the data
points.

To generally describe the shape and behaviour of


that data set.

The curve does not necessarily pass through


individual points
Such curve can not be arbitrarily chosen.
Otherwise,
different analysts would draw different curves,

If the data set points define a perfect curve


(better use interpolation)
Criteria controlling the choice of the best curve:

minimise discrepancy (error) between data points and curve

One widely known is the


least-squares regression
( today's lecture topic )
LINEAR REGRESSION:
fitting a straight line to a set of paired observations: (x1,
y1), (x2, y2), . . . , (xn, yn).

The line's equation


y=a 0&a 1 x&e Where e describes the error
Criteria for best fit

Minimize the sum of the squares of the residuals


between
the measured y and the y calculated with the linear
model
n n n

∑ e =∑ )y
Sr =
2
i i , measured
2
− y i , model * =∑ )y − a − a x *
i 0 1 i
2

i=1 i=1 i=1

This criterion yields a unique line for a given set of data


Least-Squares Fit of a Straight Line

A technique to determining the values of a0 and a1 that


minimises Sr (defined in thelast slide)
n n n

Sr = ∑ 2
ei = ∑ 2

) y i , measured − yi , model * =
2
) yi − a0 − a 1 xi *
i=1 i=1 i=1

Differentiate with respect to a0 once and with respect to a1 once more,


The minimum occurs when those derivatives are zeros

n n

= −2 ∑ ∑
∂ Sr ∂ Sr
)y i − a0 − a1 x i * = 0, = −2 ) yi − a 0 − a1 xi * x i = 0
∂ a0 ∂ a1
i=1 i=1
a1 =
n ∑ xi y i − ∑x∑i yi
2
n ∑ x
2
i − )∑ x *i

a 0 = y( − a 1 x(
( is the mean of Q
where Q
Therefore, the least-squares fit is
y = 0.07142857 + 0.8392857x
Error analysis:
Least-Squares Fit of a Straight Line

standard error of the estimate or


the standard “deviation” for the regression line

'
Sr
S y /x =
n−2

n - 2 because two data-derived estimates—a0 and a1—were used to compute Sr


To quantify the “goodness” of the fit

Compare the standard error of the estimate Sy/x


using
St: the total sum of the squares around the mean for the
dependent variable (in our case, y)

'
n


2
) y i − y( *

'
St i=1
Sy = =
n−1
n−1
St − Sr,
quantifies the improvement or error reduction due to
describing the data in terms of a straight line rather than as
an average value.

r2 : coefficient of determination

2
St − S r
r =
St
A perfect fit: Sr = 0 and r = r2 = 1, signifies that the line explains 100% of
the variability of the data.

When r = r2 = 0, Sr = St the fit represents no improvement.


Linearization of Nonlinear Relationships

In some cases, polynomial regression is appropriate.

In some others, transformations can be used to express the


data in a form compatible with linear regression.
(Linearization)
Polynomial regression
Is
A straight forward Generalisation of the linear regression.
Not included in our final Exam
This was the last topic

Next lectures, some exercises and questions


and some students' presentations for their Computer Programs

Good Luck

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy