[R] Hessian Matrix Issue

Ben Bolker bbolker at gmail.com
Mon Sep 5 17:37:54 CEST 2011

Uwe Ligges <ligges <at> statistik.tu-dortmund.de> writes:

> I have not really looked into the details of the lengthy and almost 
> unreadable code below. In any case, there are good reasons why numerics 
> software typically uses Fisher scoring / IWLS in order to fit GLMs.....
> And if your matrix is that "singular", even the common numerical tricks 
> may not save the day anymore. 7e-21 is very close to exact singularity!
> Uwe Ligges

  Your problem is with the strategy you use to try to deal with
non-finite values, i.e. setting the negative log-likelihood to 
10^20 if the calculated values are not finite.  What happens is
that, rather than just pushing the optimization away from a
bad value, you get stuck there, which leads to a "solution" to
the optimization, which is completely flat (because the objective
function is 1e20 for any value near the solution), which leads to
an uninvertible hessian.
   More specifically, inserting a browser() call at the point
after the "if (!is.finite())" call and inspecting the results
when the objective function is not finite shows that when d=1
the ifelse((d-1)>=0, ...) clause returns (d-1) as a denominator ...

  Beyond that, I can't spend any more time picking through
this ...

  Ben Bolker

More information about the R-help mailing list