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
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.