[ADMB Users] Non-matching analytic and numeric derivatives

dave fournier davef at otter-rsch.com
Fri Oct 10 10:45:29 PDT 2014


On 10/09/2014 07:32 AM, Jeff Laake wrote:

This might be of interest to others so I cc's it to the list.

In your code for the log-likelihood you have the line.

    f-= log(pch+0.000000000000000000000001);

    Now I figured that 0.000000000000000000000001  might be too small.

What would happen is that is pch is zero you will get derivatives on the 
order of

          1.0/ (0.000000000000000000000001)

and this could make the model numerically unstable at least during the 
initial fitting stage.

I modified this to

    f-= log(pch+1.e-8);

and ran the model for a while and then used the values as initial values 
to run the
model with your original code.  It converged easily.

There is nothing magical about 1.e-8. For some models you might need 
something like 1.e-4 to start.

         Dave

> Dave-
>
> Per Johnoel's request I forwarded a zip containing an example in which
> the numeric and analytic derivatives don't match when I use -dd.  The
> code fails because it thinks it should move but can't make any
> progress because it is at the min.
>
> --jeff
>
>



More information about the Users mailing list