Skip to content
Prev 383424 / 398502 Next

Problem with MASS::fitdistr().

I ran your example.
It's possible that it's another bug in the optim function.

Here's the optim call (from within fitdistr):

stats::optim(x = c(1, 4, 1, 2, 3, 1, 1, 1, 2, 2, 2, 2, 1, 1,
1, 1, 1, 4, 4, 3, 1, 2, 2, 1, 1, 3, 1, 1, 1, 4, 1, 1, 1, 1, 1, #more lines...
1, 4, 1, 1, 1, 5, 5, 5, 4, 5, 2, 5, 5, 5, 5, 3, 3, 5, 4, 5, 2, #removed...
4, 5, 5), topn = 5, lower = lwr, par = list(alpha = 1.010652,
    beta = 1.929018), fn = function(parm, ...) -sum(log(dens(parm, ...))),
    hessian = TRUE, method = "L-BFGS-B")

And here's dens:

function (parm, x, ...)
densfun(x, parm[1], parm[2], ...)

I can't see any reason why it should call dens with parm[1] < lower[1].
On Sun, Apr 26, 2020 at 5:50 PM Abby Spurdle <spurdle.a at gmail.com> wrote: