Title: Nonlinear function minimization Fish 458
1Nonlinear function minimizationFish 458
2Readings
- Ecological Detective, chapter 11
3References
- Ecological Detective chapter 11
- Hilborn and Walters
- Bard Nonlinear Parameter Estimation
4The general problem
- to find a maximum or minimum in a
multi-dimensional surface
5Warning
- The material in this lecture looks complex and
very scary - In practice the action is in intuition and good
practice - Much of the algebra is presented for
completeness, and we wont deal with it outside
the lecture - You can master this subject!
6How to find the minimum sum of squares
- direct search (ok for 1-3 parameters)
- algebra (linear regression - linear models)
- non-linear gradient searches
7Hill climbing in reverse
- Conceptually we want to walk down hill until
every direction is up - to minimize sum of
squares
8(No Transcript)
9(No Transcript)
10(No Transcript)
11How to avoid false summits
- Make sure you are on a true summit
- Look in all directions
- In SOLVER restart from solution to make sure it
has converged - See if other starting points end up at the same
place - Start SOLVER from a number of places, and see if
they all go to the same place
12Multiple starting points
13(No Transcript)
14Basic approach
- Start with a guess about X
- See which direction is down (calculate the slope
(dy/dx) - Look at the slope and the change in slope (first
and 2nd derivatives) to guess about how far we
have to go until we reach the bottom - Move that direction
- Start over again
15Newtons methodYes that is Sir Isaac
NewtonEcological Detective pp 267
16Basic logic
- Want to set first derivative to zero
- 2nd derivative is rate of change of first
derivative - divide first derivative by second derivative to
get number of units of x to jump to find where
first derivative is zero - set lambda lt 1 to prevent overshooting
17Basic theory
- If the curve is quadratic (as it is in linear
models), then the 2nd derivative is uniform over
the entire range of X and you can jump right to
the minimum - BUT if the curve is not quadratic, then you have
to iterate
18Demo in Newtons method.xls
19Linear models formulaHilborn and Walters p207
20Generalized nonlinear minimization (Hilborn and
Walters page 213)
The Jacobian
This is analogous to the X matrix in linear models
Here the sensitivity of Y to b is
21Multidimensional Newtons
22Other approaches
- Derivative free - the SIMPLEX method
- This is a very sophisticated form of hill
climbing - Simulated annealing
- Randomly jump to a new spot, if it is better then
stay there, if it is worse, go back to initial
jump
23Parameter confounding and correlation
The Hessian
24Numerical approximation
For the diagonal
25For the off-diagonal elements
26(No Transcript)
27Fraser Chum sum of squares contour
28To add
- Mle and cv for each parameter
29Variance covariance matrix
30Fraser Chums Variance-Covariance matrix A
31Parameter correlation matrixsee Hilborn and
Walters page 208
32Fraser Chums Correlation matrix C
33Further complications
- Parameter confounding
- Problems with numerical derivatives
- Non continuous problems
- Integer parameters
- Multiple minima
- Constrained parameters
34Constrained parameters
- Transform bounded parameters to unbounded using
Show demo atan_demo.xls
35Hints for successful fitting
- Test your code by fitting known data
- Find good fit to the data as a starting point
- Graph data and fit
- Manually change models to get good fit
- Check for convergence
- Restart from final solution
- Restart from different starting points
36More hints
- Constrain population sizes to not go negative
- Bounded parameters pose problems
- Usually better to do the bounding in your code or
spreadsheet ABS and ATAN methods - Particularly problematic are multiple proportions
that must add to 1 - Fix each p to be 1-sum of the previous ones
- In SOLVER use automatic scaling and set
convergence criteria smaller
37Conclusions
- Is as much art as science
- You cannot just plug numbers into a program and
hope for the best -- you must make checks to
assure convergence - The demise of a promising shark analyst
- Takes time and experience - but is well rewarded