Kyeongmi Cheon
2008-Jul-25 03:02 UTC
[R] nlminb--lower bound for parameters are dependent on each others
Hello I'm trying to solve two sets of equations (each set has four equations and all of them share common parameters) with nlminb procedure. I minimize one set and use their parameters as initial values of other set, repeating this until their parameters become very close to each other. I have several parameters (say,param1, param2) and their constraints are given as inequality and depend on each other. For example, param1>=0, param1 + param2*c1>=0 (c1 is a known positive constant) When I wrote my program as: ... myfunction1 <-function(param ){..} myfunction2 <-function(param ){..} #param1=param[1] #param2=param[2] ... while (difference.Params>eps){ ... res1 <- nlminb(param.new2, myfunction1, lower = c(0, -c1/res1$par[1]), upper = Inf) param.new1<-res1$par res2 <- nlminb(param.new1, myfunction2, lower = c(0, -c1/res2$par[1]), upper = Inf) param.new2<-res2$par difference.Params <-max(abs(param.new1-param.new2)) } I got error message: Error in -res1$par[1] : invalid argument to unary operator Is there any way to implement this constraint? Thank you for your help in advance. Kyeongmi ----- Kyeongmi, University of Memphis -- View this message in context: http://www.nabble.com/nlminb--lower-bound-for-parameters-are-dependent-on-each-others-tp18644373p18644373.html Sent from the R help mailing list archive at Nabble.com.