[R] optim()

From: Iris Zhao <rhelp.zhao_at_gmail.com>
Date: Sat 15 Jul 2006 - 04:58:07 EST

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

(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.


        [[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jul 15 05:01:57 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 18 Jul 2006 - 18:16:27 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.