<div>There are a couple different topics in this email thread so I just want to comment on both.</div><div><br></div>Specifying constraints and objectives separately<div>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.<br>
<div><br></div><div>Backtesting capability</div><div>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.).</div>
<div><br></div><div>As Brian already mentioned, PortfolioAnalytics supports backtesting for an out of sample test 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.</div>
<div><div>opt_rebal <- optimize.portfolio.rebalancing(R=ret, portfolio=pspec, optimize_method="DEoptim", search_size=2000, rebalance_on="quarters")</div><div><br></div><div>Ross</div><br><div class="gmail_quote">
On Sun, Jul 28, 2013 at 1:53 PM, Brian G. Peterson <span dir="ltr"><<a href="mailto:brian@braverock.com" target="_blank">brian@braverock.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 07/28/2013 01:50 PM, Doug Martin wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
*/[Doug] Indeed, this is crucial. I did the following with backtest<div class="im"><br>
code I used in the spring – it has a function backtest.weight that<br>
generates the time series of rebalanced weights, and looks like this<br></div>
locally (one of a bunch of examples):/*<br>
<br>
*//*<br>
<br>
*/weight.mvlub <- backtest.weight(ret, <a href="http://t.mw" target="_blank">t.mw</a>, FUN =<br>
"port.mvlub",blo,bup)$weight/*<br>
<br>
*/weight.mveq <- backtest.weight(ret, <a href="http://t.mw" target="_blank">t.mw</a>, port.eq)$weight/*<br>
<br>
*//*<br>
<br>
*/So I’m wondering if we can’t have FUN = optimize.portfolio, and pass<div class="im"><br>
the arguments for constraints and/or ojbectives as in the case of blo<br>
and bup for each instance of executing backtest.weight? I will, as we<br>
discussed in Hood River, end up using the PortfolioAnalytics backtest<br></div>
capability./*<br>
<br>
*//*<br>
<br>
</blockquote>
<br>
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).<br>
<br>
optimize.portfolio.rebalancing already returns the weights used for each rebalancing period, as well as the out of sample returns of the portfolio.<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
-- <br>
Brian G. Peterson<br>
<a href="http://braverock.com/brian/" target="_blank">http://braverock.com/brian/</a><br>
Ph: <a href="tel:773-459-4973" value="+17734594973" target="_blank">773-459-4973</a><br>
IM: bgpbraverock<br>
______________________________<u></u>_________________<br>
GSoC-PortA mailing list<br>
<a href="mailto:GSoC-PortA@lists.r-forge.r-project.org" target="_blank">GSoC-PortA@lists.r-forge.r-<u></u>project.org</a><br>
<a href="http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta" target="_blank">http://lists.r-forge.r-<u></u>project.org/cgi-bin/mailman/<u></u>listinfo/gsoc-porta</a><br>
</div></div></blockquote></div><br></div></div>