[ADMB Users] Strange step after nan

Edgar Gonzalez edgarjgonzalez at ymail.com
Wed May 2 12:20:59 PDT 2012


Hi,

I've been obtaining nan values with my code and I'm trying to understand them. I used cout to check the values of my parameters as they were changed through each function evaluation. Here's the commented output:

--------------- EVALUATION 1 ----------------
>The value of SM1 is: 2.4188
>The value of SM2 is: -0.0026
>The value of S1 is: -0.3135
>The value of S2 is: -0.0074
>The value of S3 is: 0.5715
>The value of S4 is: 0.0005
>The value of GS is: 0.6556
>The value of G1 is: 0.2917
>The value of G2 is: 0.0052
>The value of G3 is: 0.9913
>The value of G4 is: -0.0007
>The value of NS1 is: 11.6095
>The value of NS2 is: -0.2073
>The value of NS3 is: -0.78
>The value of NS4 is: 0.0147
>The value of SSS is: 1.0408
>The value of SS1 is: 2.7105
>The value of SS2 is: -0.0072
>The value of ll is: 35661.1
>
>
>
>Initial statistics: 18 variables; iteration 0; function evaluation 0
>Function value   3.5661063e+04; maximum gradient component mag  -2.9995e+04
>Var   Value    Gradient   |Var   Value    Gradient   |Var   Value    Gradient   
>  1 -0.29118 -7.65878e+03 |  2 -0.16745 -1.94756e+04 |  3  0.22306 -3.82115e+03
>  4 -0.24128 -6.19649e+03 |  5  0.03043 -5.81076e+03 |  6  0.10660 -6.79017e+03
>  7  0.19681 -1.26020e+03 |  8 -0.27356 -5.74639e+03 |  9  0.34814 -1.49102e+04
> 10 -0.15867 -1.89236e+03 | 11 -0.49363 -1.26001e+04 | 12  0.75866 -2.17818e+03
> 13 -0.48566 -2.64172e+04 | 14 -0.24226 -4.22884e+03 | 15  0.40017 -2.99951e+04
> 16  0.88007 -8.13183e+01 | 17  0.50306  7.74543e+01 | 18 -0.51172  6.60299e+01
>
>Look that I'm starting with a good negative log-likelihood value: 35661.1.

After 10 evaluations, ADMB reaches a value of 19672:


--------------- EVALUATION 10 ----------------
>The value of SM1 is: 2.43238
>The value of SM2 is: -0.00210362
>The value of S1 is: -0.29471
>The value of S2 is: -0.00709708
>The value of S3 is: 0.578347
>The value of S4 is: 0.000552595
>The value of GS is: 0.657158
>The value of G1 is: 0.298574
>The value of G2 is: 0.00552995
>The value of G3 is: 0.991372
>The value of G4 is: -0.000676023
>The value of NS1 is: 11.621
>The value of NS2 is: -0.19179
>The value of NS3 is: -0.776388
>The value of NS4 is: 0.0162437
>The value of SSS is: 1.04082
>The value of SS1 is: 2.71036
>The value of SS2 is: -0.0072012
>The value of ll is: 19672
>
>
However, on the next evaluation I get a nan:

>
>--------------- EVALUATION 11 ----------------
>The value of SM1 is: 2.5007
>The value of SM2 is: 0.000383817
>The value of S1 is: -0.203675
>The value of S2 is: -0.00558685
>The value of S3 is: 0.611781
>The value of S4 is: 0.000807524
>The value of GS is: 0.664767
>The value of G1 is: 0.332894
>The value of G2 is: 0.00701577
>The value of G3 is: 0.991727
>The value of G4 is: -0.000548353
>The value of NS1 is: 11.6752
>The value of NS2 is: -0.104003
>The value of NS3 is: -0.758469
>The value of NS4 is: 0.022198
>The value of SSS is: 1.04092
>The value of SS1 is: 2.70966
>The value of SS2 is: -0.00720709
>The value of v is: nan
>
>
>I've been debugging my code and apparently the problem is due to a large exponential value. I'm working on solving that.

However, my problem right now is that I don't understand why on the next evaluation ADMB changes the parameter values so dramatically:

--------------- EVALUATION 12 ----------------
>The value of SM1 is: 3.20126
>The value of SM2 is: 0.00564513
>The value of S1 is: 0.567494
>The value of S2 is: 0.00982242
>The value of S3 is: 0.898156
>The value of S4 is: 0.00273254
>The value of GS is: 0.738235
>The value of G1 is: 0.693724
>The value of G2 is: 0.00432671
>The value of G3 is: 0.995349
>The value of G4 is: 0.000861996
>The value of NS1 is: 11.9882
>The value of NS2 is: 0.0299506
>The value of NS3 is: -0.57073
>The value of NS4 is: -0.0243074
>The value of SSS is: 1.04191
>The value of SS1 is: 2.70261
>The value of SS2 is: -0.00726567
>The value of ll is: 45840.4
>


Look that now the value of the negative log-likelihood is 45840.4, a value that is worst that the one from where it started. So basically a good starting point was pointless...


After 41 evaluations, ADMB didn't move from this value:

 - final statistics:
>18 variables; iteration 2; function evaluation 41
>Function value   4.5840e+04; maximum gradient component mag   6.1581e+04
>Exit code = 1;  converg criter   1.0000e-04
>Var   Value    Gradient   |Var   Value    Gradient   |Var   Value    Gradient   
>  1  0.41100 -9.14221e+03 |  2  1.61813  1.73251e+04 |  3  0.57339 -1.19896e+02
>  4  0.32683 -1.58464e+02 |  5  0.56317 -3.73742e+01 |  6  0.72914 -1.49856e+01
>  7  0.31234 -3.68046e+03 |  8  0.25329  1.52480e+03 |  9  1.71514 -2.89367e+03
> 10  0.01483  3.43486e+02 | 11  0.66157  1.11757e+03 | 12  0.95836 -7.59758e+02
> 13  1.93634  6.15814e+04 | 14  0.14545 -9.47917e+03 | 15  3.15020 -1.58681e+04
> 16  0.88752 -3.36327e+01 | 17  0.49596  6.55166e+02 | 18 -0.51777  6.42341e+02


I'm running the program with the following parameter limits:

  init_bounded_number SM1(2.0,3.5)
>  init_bounded_number SM2(-0.01,0.01)
>  init_bounded_number S1(-3.0,1.0)
>  init_bounded_number S2(-0.02,0.02)
>  init_bounded_number S3(0.1,1)
>  init_bounded_number S4(-0.003,0.003)
>  init_bounded_number GS(0.01,1.0)
>  init_bounded_number G1(0.0,1.0)
>  init_bounded_number G2(-0.01,0.01)
>  init_bounded_number G3(0.98,1.01)
>  init_bounded_number G4(-0.001,0.001)
>  init_bounded_number NS1(1,12)
>  init_bounded_number NS2(-0.3,0.3)
>  init_bounded_number NS3(-1,-0.3)
>  init_bounded_number NS4(-0.025,0.025)
>  init_bounded_number SSS(0.01,1.05)
>  init_bounded_number SS1(1.0,3.0)
>  init_bounded_number SS2(-0.01,0.01)

Does anyone know the kind of rules ADMB follows when faced with a nan?

Thanks in advance,
 
Edgar J. González
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20120502/784fc98a/attachment.html>


More information about the Users mailing list