[ADMB Users] Function minimizer not making progress

dave fournier davef at otter-rsch.com
Thu Jun 2 11:54:26 PDT 2011

On 11-06-02 10:29 AM, Toshihide Hamazaki wrote:

Maybe you can write this up for the list. It is a good debugging exercise.

first one should check that the derivatives are OK.  I got rid of upper 
case names.
I hate them because they are treated inconsistently in various stuff.

./kusko  -dd 0

brings up the derivative checker. entering 0 for all parameters and 
1.e-6 for
the step size shows   That the derivatives are wrong.

Your LL is the sum of a bunch of stuff. Easiest is to identify which part
leads to the incorrect LL. Here I use the first 5 parts.

  //f = tf1+tf2+tf3+tf4+tf5+tf6+tf7+tf8;
to this
   f = tf1+tf2+tf3+tf4+tf5;

quick check of the derivatives shows they are OK.

so problem is in  this part

change to

  f = tf1+tf2+tf3+tf4+tf5+tf6+tf7;

play around a bit and you will find that tf6, 7, and 8 are all bad.
So there is an error in that part of the code.

Open the file in vi (your favourite text editor)  or take a year off and 
learn emacs.
and search for tf6.  It only occurs in 3 places.

  dvariable tf1,tf2,tf3,tf4,tf5,tf6,tf7,tf8;

    tf6 += square(log(esc(Yr_tak(n)))-log(sltak*Obs_tak(n)))/wgt_Weir;

  f = tf1+tf2+tf3+tf4+tf5+tf6+tf7+tf8;

et voila.  You didn't initialize tf6-8.

Also the model is badly scaled.  Pity they don't teach this stuff. Oh 
well so long as your self esteem is high.
You should scale your effort to have an average of 1.  Use log_q instead 
of q as the independent variable and probably also for a bunch of other
parameters. As well.  afew other things and I get

# Number of parameters = 39  Objective function value = 880.399  Maximum 
gradient component = 1.49297e-05
# Tot_Run:
  124828. 100000. 184083. 179048. 100000. 231722. 189527. 100000. 
120630. 119154. 100000. 100000. 195827. 195979. 202405. 183813. 192496. 
184842. 217128. 233187. 153358. 171826. 152269. 132511. 100000. 132118. 
220728. 243343. 408677. 337317. 371276. 239961.
# slkwe:
# sltul:
# slgeo:
# slkog:
# sltat:
# sltak:
# log_q:

thats a q of 0.00019178798954070217

You owe me $AUD 5K  (real money these days) worth of single malt.

More information about the Users mailing list