[R] optim with contraints

About this list Date view Thread view Subject view Author view Attachment view

From: Adelchi Azzalini (azzalini@stat.unipd.it)
Date: Sun 22 Jun 2003 - 01:21:59 EST

Message-id: <20030621152159.DE1E37CA824@tango.stat.unipd.it>

There seems to exist peculiar cases where optim does not take care
of constraints on the parameters to be optimized over. The call to
optim is of the form

  opt <- optim(cp, fn=sn.dev, gr=sn.dev.gh, method="L-BFGS-B",
           lower=c(-Inf, 1e-10, -0.99527),
           upper=c( Inf, Inf, 0.99527),
           control=control, X=X, y=y, hessian=FALSE)

The code has worked fine many times, but I have come across cases
(for suitable data X and y) where the constraint on the last component
is ignored; that means that a call is made to sn.dev with
       cp = -1.3546 0.4645 3.1741
so the third component exceeds 0.99527, and the program stops
because of a check in the function to be obtimised.

The call just before was to the gradient function
sn.dev.gh: gradient = 219013 -312643 441647332
which has rather large values.

To make the problem more interesting, it shows up on a Linux
(Debian) installation, but it works fine on MS-windows.
In both cases, R is 1.7.0.

Perhaps this sort of question should not be directed to the R-help
list, rather to the developer(s) of optim. Please instruct me on this
point. Also, I appreciate that the above is not a reproducible example;
this would be longish in text, and I though to ask first to whom
it is appropriate that I direct my question.

Best wishes,

Adelchi Azzalini

Adelchi Azzalini  <azzalini@stat.unipd.it>
Dipart.Scienze Statistiche, Università di Padova, Italia

______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Tue 01 Jul 2003 - 09:12:02 EST