Skip to content
Prev 383448 / 398502 Next

Problem with MASS::fitdistr().

I thought about this some more and realized my last suggestion is
unlikely to work.
Another possibility would be to create a new function to compute the
Hessian with a smaller step size, but I suspect there will be more
problems.

Possibly a much simpler approach would be to:

Modify the source for fitdistr.
(Copy the source and create a new function, say fitdistr2).

Modify it not compute the Hessian in the optim call.
Then after the optim call, test the parameter estimates.
If they're very close to the boundaries (here zero), then they're
flagged as near-boundary cases and the fitdistr2 function returns the
parameter estimates without the Hessian and related info.
(Possibly generating a warning).

If they're sufficiently distant, the Hessian and related info can be
computed in separate steps and returned.
(Equivalent to what it does currently).

I note that there's at least one R package (numDeriv), and maybe more,
for computing the Hessian, numerically.
On Mon, Apr 27, 2020 at 9:31 AM Abby Spurdle <spurdle.a at gmail.com> wrote: