[Rd] mle (stat4) crashing due to singular Hessian in covariance matrix calculation
Francisco Matorras
|r@nc|@co@m@torr@@ @end|ng |rom un|c@n@e@
Tue Feb 19 18:02:29 CET 2019
Hi, R developers.
when running mle inside a loop I found a nasty behavior. From time to
time, my model had a degenerate minimum and the loop just crashed. I
tracked it down to "vcov <- if (length(coef)) solve(oout$hessian)" line,
being the hessian singular.
Note that the minimum reached was good, it just did not make sense to
calculate the covariance matrix as the inverse of a singular Hessian. In
my case i am just interested on the value of the log-likelihood. For my
application, I patched it easily in a local version of mle just removing
this call since I am not using vcov at all, but i wonder if it can be
improved in the official release. I can imagine of two simple solutions,
either including vcov calculation as an option or avoiding the call to
solve if the hessian is singular (setting vcov to NA). I am willing to
write a few lines of coded if you think it is worth.
regards
Francisco Matorras
Instituto de Física de Cantabria
Universidad de Cantabria
More information about the R-devel
mailing list