Dear R list, I use the constrOptim to maximize a function with four constriants but the answer does not leave from the starting value and there is only one outer iteration. The function is defined as follows: tm<-function(p){ p1<-p[1]; p2<-p[2]; p3<-p[3]; p4<-1-p1-p2-p3; p1*p2*p3*p4}
##the constraints are p1>=0; p2>=0; p3>=0 and p4>=0 i.e. p1+p2+p3<=1 start<-c(0.9999991,0.0000001,0.0000001) dev<-rbind(diag(3),-diag(3),rep(-1,3)) bvec<-c(rep(0,3),rep(-1,4)) constrOptim(start,tm,NULL,ui=dev,ci=bvec,control=list(maxit=10000)) Am i missing something obviously that cause the problem or there is some bugs in constrOptim. Could you please help me out Cheers Wenwen _________________________________________________________________ Hotmail: Free, trusted and rich email service. [[alternative HTML version deleted]] ______________________________________________ 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.