[R] paramter restriction in optim

Uwe Ligges ligges at statistik.tu-dortmund.de
Fri Jun 19 18:57:23 CEST 2009



laist wrote:
> Hi,
> 
> I would like to know if you could help me... I need to restrict a parameter
> in a problem of optimization but I don't know how to do it.
> 
> function(s){
> c<-s[1]
> a1<-s[2]
> a2<-s[2]
> 
> return(-sum())
> }
> 
> optim(...)
> 
> In fact I need to know how to specify 0<=a1<=1. I've tried but without
> success


In optim "L-BFGS-B" is a method that allows for box constraints. See its 
help page or provide a full example that we can use in order to give an 
example with your data / function different from those in ?optim.

Uwe Ligges






> 
> Thank you 
>




More information about the R-help mailing list