Re: [R-SIG-Finance] PortfolioAnalytics: Custom Constraint

2016-09-19 Thread Brian G. Peterson
On Mon, 2016-09-19 at 20:22 +0530, Abhay Bhadani wrote: > I just started exploring PortfolioAnalytics package. > > Similar to setting up custom objective functions, is there a way to set up > custom constraints too? > > I would like to know how to set up cardinality constraint (i.e., limiting >

Re: [R-SIG-Finance] PortfolioAnalytics: Custom Constraint

2016-09-19 Thread Abhay Bhadani
Thanks, Brian! I implemented the following: -- data("edhec") returns <- edhec[,1:12] colnames(returns) <- c("CA","CTAG","DS","EM","EN","ED","FIA","GMLS","MA","RV","SS","FF") print(head(returns,5))

[R-SIG-Finance] PortfolioAnalytics: Custom Constraint

2016-09-19 Thread Abhay Bhadani
Hi, I just started exploring PortfolioAnalytics package. Similar to setting up custom objective functions, is there a way to set up custom constraints too? I would like to know how to set up cardinality constraint (i.e., limiting number of assets in a portfolio). Thanks!

Re: [R-SIG-Finance] PortfolioAnalytics: Custom Constraint

2016-09-19 Thread Jason Hart
I've never been able to get portfolioanalytics to work for me.  It looks like a nice little addition to the R arsenal but we just weren't meant to work together.  I figured what the heck I'll try this code and I got the same error message I usually get: Error in optimize.portfolio(R =