Dear all, I have two functions (f1, f2) and 4 unknown parameters (p1, p2, p3, p4). Both f1 and f2 are functions of p1, p2, and p3, denoted by f1(p1, p2, p3) and f2(p1,p2,p3) respectively. The goal is to maximize f1(p1, p2, p3) subject to two constraints: (1) c = k1*p4/(k1*p4+(1-k1)*f1(p1,p2,p3)), where c and k1 are some known constants (2) p4 = f2(p1, p2, p3) In addition, each parameter ranges from 0 to 1, and both f1 and f2 involve integrations. I tried to use lagrange multipliers to eliminate two equality constraints and then use optim() to find the maximum value and optimal parameter estimates. So I let fn be f1+lambda1*(c- k1*p4/(k1*p4+(1-k1)*f1(p1,p2,p3))) + lambda2(p4-f2(p1,p2,p3)). The error message I got was "Error in fn(par, ...) : recursive default argument reference." I wonder whether current build-in functions in R can do this type of jobs. Any suggestion will be greatly appreciated. Iris [[alternative HTML version deleted]]
Dear all, I am working on optimization problem and have some trouble running optim(). I have two functions (f1, f2) and 4 unknown parameters (p1, p2, p3, p4). Both f1 and f2 are functions of p1, p2, and p3, denoted by f1(p1, p2, p3) and f2(p1,p2,p3) respectively. The goal is to maximize f1(p1, p2, p3) subject to two constraints: (1) c = k1*p4/(k1*p4+(1-k1)*f1(p1,p2,p3)), where c and k1 are some known constants (2) p4 = f2(p1, p2, p3) In addition, each parameter ranges from 0 to 1, and both f1 and f2 involve integrations. I tried to use lagrange multipliers to eliminate two equality constraints and then use optim() to find the maximum value and optimal parameter estimates. So I let fn be f1+lambda1*(c- k1*p4/(k1*p4+(1-k1)*f1(p1,p2,p3))) + lambda2(p4-f2(p1,p2,p3)). The error message I got was "Error in fn(par, ...) : recursive default argument reference." I wonder whether current build-in functions in R can do this type of jobs. Any suggestion will be greatly appreciated. Iris [[alternative HTML version deleted]]