[R] Help on optim
dimitris.rizopoulos at med.kuleuven.be
Wed Sep 21 11:01:12 CEST 2005
you don't need L-BFGS-B in this case since you can easily
re-parameterize you problem, i.e., you can always write:
pi_i = exp(a_i) / sum(exp(a_i)), with e.g., a_1 = 0
and thus maximize with respect to a_i's.
I hope it helps.
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
----- Original Message -----
From: "Manoj" <manojsw at gmail.com>
To: <r-help at stat.math.ethz.ch>
Sent: Wednesday, September 21, 2005 10:33 AM
Subject: [R] Help on optim
> Dear R-help,
> I am new to optim function and need some help with
> Problem description: I am trying to optimize a weights vector
> such that it produce maximum value for a function maxVal. The
> optimization is subjected to constraint. The constraints are a) Min
> weight should be greater than or equal to Zero. b) Max weight should
> be less than or equal to 1 c) Sum of the weights should be equal to
> Now after googling around a bit & trying my hands at RSiteSearch , I
> found that I can use optim with L-BFGS-B method and could possible
> lower bound and upper bound for constraint, however I am clueless as
> to how I can impose the sum(wgts) = 1 condition. In excel solver,
> problem is extremely simple since it's just a matter of setting an
> additional constraint of setting the summation cell to 1.
> Your kind help is greatly appreciated.
> Best Regards
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide!
More information about the R-help