Re: [R] Optim() violates constraints

From: Ben Bolker <>
Date: Fri, 20 Jun 2008 13:18:26 +0000 (UTC)

Zornitsa Luleva <zornitsa.luleva <at>> 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 and not the list about it, but ... it's actually an optim() issue. Various people have hit this kind of problem in rare circumstances.;user=guest

  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 mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri 20 Jun 2008 - 15:53:58 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 20 Jun 2008 - 16:30:46 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive