[R] Help on optim

Dimitris Rizopoulos 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.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm




----- 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 
> optimization.
>
>       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 
> 1.
>
> 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 
> use
> 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, 
> this
> 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
>
> Manoj
>
> ______________________________________________
> R-help at 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
> 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm




More information about the R-help mailing list