[R] optim with contraints

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Jun 21 18:00:55 CEST 2003


Adelchi,

R is a volunteer project, and we would need a volunteer to look at this.  
`The developers of optim' (who are R-core) used published code for this
method. Since you are getting different answers on different platforms
this might be a bug in your compiler or run-time rather than R.

Please submit a reproducible bug report to R-bugs.  As you will see some
bugs don't get fixed very fast (including one I submitted from Padua in
2001).

Brian

On Sat, 21 Jun 2003, Adelchi Azzalini wrote:

> 
> 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
> 
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list