









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Notes; Professor: Seaton; Class: APPLIED CALCULUS; Subject: Mathematics; University: Rhodes College; Term: Fall 2008;
Typology: Study notes
1 / 17
This page cannot be seen from the preview
Don't miss anything!
In Module 1 we dealt with situation where a model could be fitted exactly to the data. It is always possible to find a model that fits the data exactly. This is not, however, the most appropiate way of modeling the data, especially if want to use the model to make predictions about future events. It is also inefficient, since there are as many parameters to calculate as there are data points. An efficient model is one with the fewest parameters that still manages to describe the behaviour of the data. The disadvantage of using a model with fewer parameters than data points is that it will not pass through all the data points, and so we find the model that is the ‘best fit’ for the data. The first problem shows you have to fit the ‘best’ model of the form y = mx to the data. Within this problem we look at various ways of selecting the ‘best’ model. In the second problem we fit the ‘best’ model of the form y = mx + b. In the final problem, and in the projects that your group will be assigned, you will first fit find and exact fit model, then a two parameter non-linear model and finally fit a model with more than two parameters. We will then compare the properties of these models. In the process of completing these problems, we will see how to find minimum and maximum values of functions, and see how to find derivatives of functions in several variables.
A biologist is studying how fast the root of a particular specises of plant grows. The results of one experiment are below. The biologist believes that the ‘law’ of root growth is Growth = m × Days,
and has asked us to determine the value of m from the experimental data.
Day Growth (mm) 0 0 1 1. 2 3. 3 4. 4 6. 5 7. 6 7.
Instructions
Fill out the table below for your line:
xi yi mxi yi − mxi (yi − mxi)^2 0 0 0 0 0 1 1.
i=
(yi − mxi)^2 =
V 2 (m) =
i=
(yi − mxi)^2 =.........
In Problem 1, to find the “best” fitting line of the form y = mx we found the value of m that minimized the function
V 2 (m) =
(1. 2 − m)^2 + (3. 8 − 2 m)^2 + (4. 2 − 3 m)^2 + (6. 3 − 4 m)^2 + (7. 2 − 5 m)^2 + (7. 3 − 6 m)^2
It was claimed that V 2 (m) represented the total distance between the data points and the model (the y = mx line), so the lower this distance the better the fit. There are, however, alternative ways to measure the distance between a data set and a model.
A residual is a distance from a single data point and the curve of the model. The total distance function is a combination of all the residuals. When deriving the function V 2 , we used ‘vertical’ residuals (i.e., residuals which are parallel to the y-axis). We could, however, use a horizontal residual (i.e., one parallel to the x-axis), or a perpendicular residual (i.e., one at right-angles to the model line). These three alternatives are illustrated below:
(xi, yi)
yi − mxi
(xi, mxi)
Vertical Residual
(xi, yi) xi^ −^
y mi ( y mi , yi)
Horizontal Residual
(xi, yi) (y √im−mx (^2) +1i) (xi, yi)
Perpendicular Residual
To calculate the total distance functions from these three residuals, we can square each residual distance, sum all these, and find the square root of this sum. The values of the seven residuals for these three possibilities are given below:
Data Point Vertical Horizontal Perpendicular (0, 0) 0 0 0
(1, 1 .2) 1. 2 − m 1 − (^1) m.^2 √^1 .m^2 − (^2) +1m
(2, 3 .8) 3. 8 − 2 m 2 − (^3) m.^83 √.^8 m− (^22) +1m
(3, 4 .2) 4. 2 − 3 m 3 − (^4) m.^24 √.^2 m− (^23) +1m
(4, 6 .3) 6. 3 − 4 m 4 − (^6) m.^36 √.^3 m− (^24) +1m
(5, 7 .2) 7. 2 − 5 m 5 − (^7) m.^27 √.^2 m− (^25) +1m
(6, 7 .3) 7. 3 − 6 m 6 − (^7) m.^37 √.^3 m− (^26) +1m
From this table we can easily write down the different total distance functions:
V 2 (m) =
(1. 2 − m)^2 + (3. 8 − 2 m)^2 + (4. 2 − 3 m)^2 + (6. 3 − 4 m)^2 + (7. 2 − 5 m)^2 + (7. 3 − 6 m)^2
H 2 (m) =
m
m
m
m
m
m
P 2 (m) =
These functions are defined in the Mathematica file named M3 P1 OtherOFs.nb. We find the critical point of these functions, and use a test to confirm that the point is a local minimum. Note that each function gives a different optimal value for the slope of the of the straight line model.
Once the type of residual has been selected we have to have a scheme for combining the individual residuals into a ‘total distance’. The scheme we have been using is to square, add and square root the sum (we can call this as ‘pythagorean scheme’). Other schemes are:
In other words we can define the total distance function, for this set of data, by any one of the formulae below, for any whole value of p:
Vp(m) = [(1. 2 − m)p^ + (3. 8 − 2 m)p^ + · · · + (7. 2 − 5 m)p^ + (7. 3 − 6 m)p]
1 p
Hp(m) =
m
)p
m
)p
m
)p
m
)p] (^1) p
Pp(m) =
)p
)p
)p
)p] (^1) p
Note that for odd values of p the functions Vp, Hp and Pp do not have a minimum. They either increase or decrease. They do, however, pass through the x-axis, meaning that there is a value of m for which the ‘total distance’ between data and model is zero (this is when the positive residuals cancel out the negative residuals). So, for odd values of p we find the optimal value of m by finding the zero of the distance function.
x
y (^) y = mx + b
(xi, yi)
yi − (mxi + b)
Vertical Residual
x
y (^) y = mx + b
x^ (xi, yi) i −^ yi m−b
Horizontal Residual
x
y (^) y = mx + b
(xi, yi)
yi√−mmx (^2) +1i−b
Perpendicular Residual
Hence, the list of objective functions, we have to choice from, is:
Vp(m, b) = [(95 − 20 m − b)p^ + (90 − 27 m − b)p^ + · · · + (109 − 44 m − b)p^ + (115 − 46 m − b)p] p^1
Hp(m, b) =
[( 20 − 95 −^ b m
)p
( 27 − 90 −^ b m
)p
( 44 − 109 −^ b m
)p
( 46 − 115 −^ b m
)p] (^1) p
Pp(m, b) =
[( (^95) √− 20 m − b m^2 + 1
)p
( (^90) √ − 27 m − b m^2 + 1
)p
( (^109) √ − 44 m − b m^2 + 1
)p
( (^115) √ − 46 m − b m^2 + 1
)p] (^1) p
Their values will change with both m and b. Their graphs are surfaces. Below is the graph of V 2 (m, b):
0
1
2 40
50
60
70
80
0
50
100
150
0
1
It is hard to see that this function does have a minimum value. However we can try
to solve the two of simultaneous equations
∂m
= 0 and
∂b
= 0. This will give us
points, if any exist, where both rate of change in the m-direction is zero, and the rate of change in the b-direction is zero.
Age (Months) Score 20 95 27 90 30 98 35 103 41 112 44 109 46 115
Provide a graphic evidence that the model is valid.
Day Growth (mm) 0 0 1 1. 2 3. 3 4. 4 6. 5 7. 6 7.
Comment on whether a model of the form y = mx or a model of the form y = mx + b is most suitable for this data.
The next three diagrams show how the different residuals are defined
y = f (x)
(xi, yi)
yi − f (xi)
(xi, f (xi))
Vertical Residual
y = f (x)
(xi, yi)
xi − f −^1 (yi) (f −^1 (yi), yi)
Horizontal Residual
(xi, yi) y = f (x) √ (xi − xˆ)^2 + (yi − yˆ)^2
(ˆx, yˆ)
Perpendicular Residual: The value of ˆx is the solution of yi − f (ˆx) = f ′(ˆx)(ˆx − xi), and the value of ˆy is f (ˆx).
Notice that in order to calculate either horizontal or perpendicular residuals one must first solve an equation. Consequently, these often involve practical difficulties, and vertical residuals are often the only ones that can be calculated.
There are situations where using horizontal or vertical residuals can give inaccurate values to ‘the distance from point to curve’. These are illustrated below.
(xi, yi) Vertical residual gives an erroneously large distance.
The most critical stage of a 100m race is as the athlete accelerates out of the blocks. The athlete will be able to maintain the speed they manage to reach in this phase. Below are the values of an athlete’s acceleration in the first 0.8 seconds of a practice run. What is the athlete’s speed 0.8 seconds into the run?
Time (sec) Acceleration (m/s^2 ) 0 20. 0.1 20. 0.2 19. 0.3 17. 0.4 14. 0.5 9. 0.6 5. 0.7 1. 0.8 0
Suppose we want to fit a cubic model to the data, ie. a model of the form a(t) = at^3 + bt^2 + ct + d, then we will follow the same proceedure as before. We define the total distance function, and find where this function is a minimum.In this example if used the V 2 total distance function it would be defined as
V 2 (a, b, c, d) = [(20. 4 − a(0))^2 + (20. 3 − a(0.1))^2 + (19. 4 − a(0.2))^2 + (17. 3 − a(0.3))^2 + (14 − a(0.4))^2 + (9. 8 − a(0.5))^2 + (5. 3 − a(0.6))^2 + (1. 6 − a(0.7))^2 + (0 − a(0.8))^2 ]
(^12)
To minimize this function we find all four partial derivatives of V 2 , and find the locations when all four are simultaneously equal to zero. That is solve:
∂V 2 ∂a
∂b
∂c
∂d
We now need to run some type of test to classify the type of critical points we have found. Unfortunately the equivalent of the second derivative test is too complex for this course. We can’t even examine the graph of V 2 to see if the location looks like a minimum, because the graph of V 2 lies in five dimensional space. The only check we can perform is to plot the data and the new model and see if it is a reasonable fit.
When each of the stages is done on Mathematica (using file: M3_P4_acceleration.nb) we find that the model that minimizes the V 2 function is a(t) = 80. 8923 t^3 − 120. 209 t^2 +
0.2 0.4 0.6 0.8 1
Time HsL
5
10
15
20
Acc Hm•s^2 L (^) Acceleration
So we cross our fingers and hope that this really is a minimum and not some four dimensional equivalent of a saddle point.