[GSoC-PortA] Constraints and Objectives Separately in Optimize.Portfolio

Doug Martin martinrd at comcast.net
Mon Jul 29 17:00:41 CEST 2013


 

 

 

From: gsoc-porta-bounces at lists.r-forge.r-project.org
[mailto:gsoc-porta-bounces at lists.r-forge.r-project.org] On Behalf Of Ross
Bennett
Sent: Sunday, July 28, 2013 7:39 PM
To: PortfolioAnalytics
Subject: Re: [GSoC-PortA] Constraints and Objectives Separately in
Optimize.Portfolio

 

There are a couple different topics in this email thread so I just want to
comment on both.

 

Specifying constraints and objectives separately

I'll spend some time on this to get it working. Appreciate the suggestion
from Brian to simply insert the constraints/objectives in the appropriate
slots into the portfolio object so the optimize.portfolio function and
subfunctions can still work off of the portfolio object.

 

[Doug] That will be great.

 

Backtesting capability

The backtest.weight function we used in class was convenient in that we
could specify a function with the FUN argument, but the downside was that we
had to write functions for each optimization case (i.e. port.gmv, port.etl,
port.lo, etc.).

 

[Doug] I agree.

 

As Brian already mentioned, PortfolioAnalytics supports backtesting for an
out of sample test

[Doug] And according Brian also saves everything you would want, including
optimizer trace output, etc.

and I have modified it to work with the new portfolio interface. This is
nice and modular because the user just has to pass in the return object,
portfolio object with the constraints and objectives, and a few other
parameters to run the backtest and return the set of weights.

opt_rebal <- optimize.portfolio.rebalancing(R=ret, portfolio=pspec,
optimize_method="DEoptim", search_size=2000, rebalance_on="quarters")

 

[Doug] This is also very good.  So for example with a single objective and
many constraints, just need to build a bunch of constraint objects that the
user names, and use them as inputs.

 

Ross

 

On Sun, Jul 28, 2013 at 1:53 PM, Brian G. Peterson <brian at braverock.com>
wrote:

On 07/28/2013 01:50 PM, Doug Martin wrote:

*/[Doug] Indeed, this is crucial.  I did the following with backtest


code I used in the spring - it has a function backtest.weight that
generates the time series of rebalanced weights, and looks like this

locally (one of a bunch of examples):/*

*//*

*/weight.mvlub <- backtest.weight(ret, t.mw, FUN =
"port.mvlub",blo,bup)$weight/*

*/weight.mveq <- backtest.weight(ret, t.mw, port.eq)$weight/*

*//*

*/So I'm wondering if we can't have FUN = optimize.portfolio, and pass


the arguments for constraints and/or ojbectives as in the case of blo
and bup for each instance of executing backtest.weight?  I will, as we
discussed in Hood River, end up using the PortfolioAnalytics backtest

capability./*

*//*


Well, optimize.portfolio.rebalancing already exists, and I think covers thae
most common use case of periodic rebalancing of a portfolio for an 'out of
sample' test of your portfolio specification (w/ constraints/objectives).

optimize.portfolio.rebalancing already returns the weights used for each
rebalancing period, as well as the out of sample returns of the portfolio.




-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock
_______________________________________________
GSoC-PortA mailing list
GSoC-PortA at lists.r-forge.r-project.org
http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/gsoc-porta/attachments/20130729/cfca8395/attachment.html>


More information about the GSoC-PortA mailing list