lecture 5 curve fitting by iterative approaches marine qb iii marine qb iii modelling aquatic rates...
Post on 21-Dec-2015
213 views
TRANSCRIPT
Lecture 5Curve fitting by iterative approaches
MARINE QB IIIMARINE QB III Modelling Aquatic Rates In Natural Ecosystems BIOL471
© 2001 School of Biological Sciences, University of Liverpool
School of
Biological Sciences
School of
Biological Sciences
Curve fitting: the iterative approach
Ing
esti
on
Prey 0
Hc =k+ H
HmaxH
Linear Functions General linear equations
Any straight line can be represented by the general linear equation
y = mx + c
y1
x1
y2
or (y1 +y)
y (y2 - y1)
x2 or (x1 +x)
x (x2 - x1) Slope (m) (y/ x)Intercept (c)
Origin
00
Y = a + bX
a
b
X is the independent variable since its value is freely chosen
X
Y is the dependent variable since its value depends on x
Y
0 1 2 3
15
30
45
Regression Analysis
Y = a + bX
Often X may be thought of as the cause and Y as the effect of that cause
0 1 2 3
15
30
45
Hei
ght
clim
bed
cause (C)
effe
ct (
E)
Regression Analysis
E = a + bC
Some basic algebra
bXaY Remember the equation of a straight line:
However when doing regression analysis, this becomes a statistical model
The model is a way of estimating values of Y, given a value of X and the constants a and b
But Y is estimated. Therefore:
Where a is the Y-intercept, and b the slope
b is also called the regression coefficient
bXaY
Model 1 Regression Analysis
In Model 1 Regression
X is measured without error
X measurements are independent
X is under the control of the investigator
For a value of X there is a population of Y-values, which are normally distributed
There is equal variance of Y at each X value
X
Y
Note, in Model 2 regression both X and Y are random variable – we will not be discussing this
The figure now shows the line of best fit
The line is a model of the relationship between X and Y
We have selected our subjects with known values of X and then measured Y
X
Y
The line of best fit
The line of best fit
How do we select the line of best fit?
We expect it to pass through (X,Y )…
For any line, we could calculate the vertical deviations of each point from that line
XX
Y
Y
How do we select the line of best fit?
We expect it to pass through (X,Y )…
For any line, we could calculate the vertical deviations of each point from that line
Squaring the deviations makes them positive
Summing them gives the sum of the squares of the deviations
XX
Y
Y
22 YYd
The line of best fit
The line of best fit will minimise d 2
22 YYd
Now we can write the regression equation
22 bXaYd
bXaY
By definition
The regression equation is
By substitution
XbYa
22 XXn
YXXYnb
Calculating values of a and b
bXaY
We need to obtain values of a and b that give minimum value of this expression for sum of squares of deviations from the fitted line
We solve this with differential calculus
To obtain
Then
Calculating the line of best fit
That was one method of finding the line of best fit, called least squares regression
It works because, using calculus we can solve for b
However, there are some equations (non-linear ones) that we cannot solve this way
Instead we use another method: Iterative fitting
X
Y
Here are the steps:1. make an estimate of the
parameters, in this case, the slope (b) and the intercept (a)
2. Calculate the sum of squares of deviations from the fitted line
X
Y
22 YYd
The line of best fit by iteration
3. Record this value, and then try another pair of estimates of a and b
Here are the steps:1. make an estimate of the
parameters, in this case, the slope (b) and the intercept (a)
2. Calculate the sum of squares of deviations from the fitted line
3. Record this value, and then try another pair of estimates of a and b
4. Calculate the sum of squares… repeat until you obtain the smallest sum of squares you can get
5. When the sum of squares is minimal, this is the best fit
X
Y
The line of best fit by iteration
22 YYd
This process may seem very labourious, but computers make it possible
Steps1. Look at the data and
think about it2. Decide if you need non-
linear regression3. Pick a mathematical
model4. Choose initial parameter
values (although some programes do this for you)
5. Fit the curve to the data
X
Y
The line of best fit by iteration
bXaY
The line of best fit by iterationYou must satisfy these
assumptions for iterative-fitting
1. X is measured without error 2. X is under the control of the
investigator 3. X values are independent of
each other 4. For a value of X there is a
population of Y-values, which are normally distributed
5. There is equal variance of Y at each X value
X
Y
The line of best fit by iterationNext, ask yourself the following questions1. Does the curve go through the data (if you
pick the wrong initial parameters it can all go pear-shaped)?
2. Are the best-fit parameters plausible (see above)?
3. How precise are the best-fit parameters (we will learn about how to calculate precision in a minute)?
4. Would another model be more appropriate?
5. Have you violated any of the assumptions for iterative-fit regressions?
Curve fitting using Follow these steps1. Open SigmaPlot 8.0
Curve fitting using SigmaPlot 8.0Follow these steps1. Open SigmaPlot 8.02. Enter data into spread sheet (our data set
will be a functional response)
Curve fitting using SigmaPlot 8.0Follow these steps1. Open SigmaPlot 8.02. Enter data into spread sheet (our data set
will be a functional response)3. Make a graph
Curve fitting using SigmaPlot 8.0Follow these steps1. Open SigmaPlot 8.02. Enter data into spread sheet (our data set
will be a functional response)3. Make a graph4. Click on the data
Curve fitting using SigmaPlot 8.0Follow these steps1. Open SigmaPlot 8.02. Enter data into spread sheet (our data set
will be a functional response)3. Make a graph4. Click on the data5. In the “statistics” drop down menu, chose
“regression wizard”
Curve fitting using SigmaPlot 8.0Follow these steps1. Open SigmaPlot 8.02. Enter data into spread sheet (our data set
will be a functional response)3. Make a graph4. Click on the data5. In the “statistics” drop down menu, chose
“regression wizard”6. Choose “hyperbola” in the “equation
category”7. Choose “2-paramerter” in the “equation
name”