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 Thank you -- View this message in context: http://www.nabble.com/paramter-restriction-in-optim-tp24110745p24110745.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]
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 > successIn 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 >