[R] Help using spg optimization in BB package

Ravi Varadhan RVaradhan at jhmi.edu
Wed Apr 22 16:55:41 CEST 2009


You can try defining a "projection" function as follows:

	project <- function(x) x / sum(x)

This should work fine.  

Let me know if you have any trouble.

Ravi.


----------------------------------------------------------------------------
-------

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: rvaradhan at jhmi.edu

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 

----------------------------------------------------------------------------
--------


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of dre968
Sent: Wednesday, April 22, 2009 8:23 AM
To: r-help at r-project.org
Subject: [R] Help using spg optimization in BB package


i'm trying to use the BB package to minimize the sum of the squared
deviations for 2 vectors.  The only thing am having trouble with is defining
the project constraint.  I got the upper and lower bounds to work but i am
not sure how to create a constraint that the sum of x must be 1.  Any help
would be greatly appreciated.  
--
View this message in context:
http://www.nabble.com/Help-using-spg-optimization-in-BB-package-tp23175224p2
3175224.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list