Hello. I had previously posted a question concerning the optimization
of a nonlinear function conditional on equality constraints. I was
pointed towards the contrOptim function. However, I do not understand
the syntax of this function with respect to specifying the constraints
and so I don’t know if it is what I need. The command is:
constrOptim(theta, f, grad,ui,ci,…). “theta” is the initial value of
the variables in the function, “f” and “grad” are the function to be
optimized and its gradient functions (partial deriviatives). Now, “ui”
and “ci” are stated to be constraints in the help documentation but it
is not explained how these constraints are to be specified. To be
concrete, here is my objective function:
f<- -1*pi*log(pi) i.e. the entropy of a vector of probabilities (pi)
The constraints are the first moments of the distribution:
C1=sum(k1*pi); C2<-sum(k2*pi); etc.
Any help is appreciated.
Bill Shipley
Associate Editor, Ecology
North American Editor, Annals of Botany
Département de biologie, Université de Sherbrooke,
Sherbrooke (Québec) J1K 2R1 CANADA
Bill.Shipley@USherbrooke.ca
<http://callisto.si.usherb.ca:8080/bshipley/>
http://callisto.si.usherb.ca:8080/bshipley/
[[alternative HTML version deleted]]