[ADMB Users] Non-matching analytic and numeric derivatives

Ben Bolker bbolker at gmail.com
Fri Oct 10 10:53:12 PDT 2014


  1e-8 is a *little* bit special/magical, because it's close to the square
root of the minimum representable deviation for a double-precision floating
point value -- it's used a lot as a default precision in a certain
well-known language & environment for statistical computing ...

On Fri, Oct 10, 2014 at 1:45 PM, dave fournier <davef at otter-rsch.com> wrote:

> 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
>>
>>
>>
> _______________________________________________
> Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20141010/6678d8a9/attachment.html>


More information about the Users mailing list