[R] Optim() violates constraints

Ben Bolker bolker at ufl.edu
Fri Jun 20 15:18:26 CEST 2008

Zornitsa Luleva <zornitsa.luleva <at> gmail.com> writes:

>  Hi,
> I am using the mle2 method of the package 'bbmle'. The method is calling as
> far as I understood it the optim method "L-BFGS-B" (this is the method I
> use). The latter one allows the user to impose box constraints on the
> variables, i.e. to give lower and upper bounds. It is important that the
> initial values satisfy the constraints. In my problem, it is the case. I do
> not know if there is something else to watch for, but the algorithm violates
> the constraints that I have given and therefore, my algorithm is not
> working. Do you have any idea what I can do about it?
> Thank you very much in advance!
> Zoe

  Well, bbmle is my package so technically you should be
writing to me (bolker at ufl.edu) and not the list about it, but ...
it's actually an optim() issue. Various people have hit this kind of problem
in rare circumstances.


  The usual advice is (1) to use the parscale option within
the control argument to make sure the problem is scaled properly 
(this will usually fix most L-BFGS-B problems), (2) if necessary
set the bounds just a little bit inside the true constraints.

  If this doesn't fix the problem, please post (as suggested
in the posting guide) a minimal, self-contained, reproducible
example ...

   Ben Bolker

More information about the R-help mailing list