[R] constraints in optim?

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Oct 2 10:11:40 CEST 2004


Do you know what you are doing using method SANN?  It is a very strange 
choice for a 2D problem.  Method L-BFGS-B would allow non-negativity 
constraints.

optim() does not have control options trans and times ...

The standard way would be to transform your problem, for example to 
optimize over log-parameters, if you really meant `positive' and not
`non-negative'.

On Sat, 2 Oct 2004, Christian Schulz wrote:

> optim(c(1,1),LL,method="SANN",control=list(fnscale=-1),trans=trans,times=times)
> $par
> [1] 17.422635 -1.606859
> 
> How could i constraint that the parameters should be both positive in
> my maximizing problem?
> I check constrOptim but here i could only constraint the variables trans and 
> times and not my parameters?


> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

That applies to YOU.

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