Anda di halaman 1dari 23

GEOKOMPUTASI

Pertemuan ke-6

Curve Fitting and Optimization


Introduction
Least Square Regression
Linear
Non-Linear

Introduction
Data is often given for discrete values along a continuum. However,
you may require estimates at points between the discrete values
Describes techniques to fit curves to such data to obtain intermediate
estimates
General
eneral approaches for curve fitting :
where the data exhibits a significant degree of error or noise, the strategy is to
derive a single curve that represents the general trend of the data.
data One approach of
this nature is called least-squares
squares regression
where the data is known to be very precise, the basic approach is to fit a curve or a
series of curves that pass directly through each of the points.
points The estimation of
values between well-known discrete points is called interpolation

Three attempts to fit a best curve through five data


points.

(a) Least-squares regression,

(b)
b) linear interpolation,

(c) curvilinear interpolation

Two types of applications are generally encountered when fitting


experimental data: trend analysis and hypothesis testing.
Trend Analysis :
represents the process of using the pattern of the data to make predictions.
Used to predict or forecast values of the dependent variable
Hypothesis Testing :
an existing mathematical model is compared with measured data.
data If the
model coefficients are unknown, it may be necessary to determine values that
best fit the observed data. On the other hand, if estimates of the model
coefficients are already available, it may be appropriate to compare predicted
values of the model with observed values to test the adequacy of the model.
Often, alternative models are compared and the best one is selected on the
basis of empirical observations.

Least Square Regression

(a) Data exhibiting significant


error,

(b) Polynomial fit


oscillating beyond the range of
the data

(c) More satisfactory


result using the least-squares fit.

Linear Regression

The simplest example of a least-square


square approximation is fitting a straight line p
observation : (x1, y1), (x2, y2), . . . , (x
( n, yn).
y = a0 + a1x + e

a0 = coefficients representing the intercept


a1

coefficients representing the slope

error, or residual between the model and the observati

e = y - a0 - a1x
The
he error, or residual, is the discrepancy between the true value of y and the
approximate value, a0 + a1x , predicted by the linear equation

Linear Regression
Criteria for a "Best" Fit

minimize the sum of the residual errors for all the available data

(a) minimizes the sum of the residuals,

Linear Regression
Criteria for a "Best" Fit

(b)
b) minimizes the sum of the absolute
values of the residuals,

Linear Regression
Criteria for a "Best" Fit
A third strategy for fitting a best line is the minimax criterion. In this
technique, the line is chosen that minimizes the maximum distance that an
individual point falls from the line

) Minimizes the maximum error of any individual point

It should be noted that the minimax principle is sometimes well-suited


well
for
fitting a simple function to a complicated function (Carnahan, Luther, and
Wilkes, 1969).

Linear Regression
Minimize the sum of the squares of the residuals between the
measured y and the y calculated with the linear model

Linear Regression
Least-Squares
Squares Fit of a Straight Line
To determine values for a0 + a1

Setting these derivatives equal to zero will result


in a minimum Sr

realizing that a0 = na0

where y and x are the means of y and x, respectively.

Example
Fit a straight line to the x and y
values in the first two columns

SOLUTION

Xi
Yi
1
0.5
2
2.5
3
2
4
4
5
3.5
6
6
7
5.5
ml X 28 jml Y 24
jml Xi^2
ata X 4
rata Y 3.428571

Xi^2
1
4
9
16
25
36
49
140

Quantification of Error of Linear Regression

the square of the residual represented the square of the discrepancy


between the data and a single estimate of the measure of central
tendencythe mean
the square of the residual represents the square of the vertical distance
between the data and another measure of central tendencythe
straight line

Regression data showing (a)


a) the spread of the data around the mean of the dependent variable and (b) the spread of
data around the best-fit
fit line. The reduction in the spread in going from (a) to (b), as indicated by the bell-shaped curves
the right, represents the improvement due to linear regression

Polynomial Regression
For example, suppose that we fit a second-order
second
polynomial or
quadratic

where all summations are from i = 1 through n. Note that the above
three equations are linear and have three unknowns: a0, a1, and a2.
The coefficients of the unknowns can be calculated directly from the
observed data.
The two-dimensional
dimensional case can be easily extended to an mth-order
polynomial as
mth
mth-order
polynomial

the standard error is formulated as

EXAMPLE
Fit a second-order
order polynomial to the data in the first
two columns

SOLUTION

Solving these equations through a technique such as Gauss


elimination gives a0 = 2.47857,
a1 = 2.35929, and a2 = 1.86071. Therefore, the least-squares
least
quadratic equation for this
case is y = 2.47857 + 2.35929x + 1.86071x2
The standard error of the estimate based on the regression
polynomial is

Anda mungkin juga menyukai