Date: 2021-12-17 07:53 Sender: Ott ToometAdded comment in documentation (Rev 1753). |
Date: 2013-11-04 08:00 Sender: Ott ToometYes, I think we go for this. Should mention this in documentation, and look if it actually constitutes a bug in optim(). |
Date: 2013-11-04 07:37 Sender: Arne HenningsenI was partly wrong in my previous comment. I thought that the sign of the log-likelihood function was "manually" changed in the code of the maxLik() package but we already use optim()'s argument "control = list( fnscale = -1)". If print.level >= 1 (i.e. optim()'s control parameter "trace" >= 1), optim() reports the value of the objective function multiplied by "fnscale" so that Ott was right when he wrote that we would need to change optim() to fix this bug. Sorry for my mistake! I suggest that we do not change optim() but inform/warn the maxLik users in the documentation and/or maxBFGS() writes a short message if it is called with print.level >= 1. What do you think? We could also consider to file a bug report / feature request for optim().
|
Date: 2013-10-31 12:43 Sender: Arne HenningsenWe should not change optim() and we do not need it. optim() maximises the objective function, if one adds the argument "control = list( fnscale = -1)". |
Date: 2013-10-31 12:02 Sender: Ott ToometI guess the reason is the following:
maxBFGS is implemented by optim (in a fortran library AFAIR). These are minimization routines. As we use maximization by default we have to swap the sign. However, printing output at each iteration is done internally in optim() and hence it shows the wrong sign.
I don't know if there is any easy remedy except mentioning it in the documentation. An alternative were to hack the original source code, but that would add a substantial isntallation burden to maxLik (currently we stay free from compiled code). |
Date: 2013-10-31 11:53 Sender: Arne HenningsenThank you, Florian, for reporting this bug. It also occurs, when one uses maxBFGS() through maxLik():
b <- maxLik(loglik, start=1, print.level=1, method="BFGS")
We'll take a look.
/Arne |