[GSoC-PortA] Constraints and Objectives Separately in Optimize.Portfolio
Ross Bennett
rossbennett34 at gmail.com
Mon Jul 29 04:38:41 CEST 2013
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.
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.).
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.
opt_rebal <- optimize.portfolio.rebalancing(R=ret, portfolio=pspec,
optimize_method="DEoptim", search_size=2000, rebalance_on="quarters")
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<GSoC-PortA at lists.r-forge.r-project.org>
> http://lists.r-forge.r-**project.org/cgi-bin/mailman/**listinfo/gsoc-porta<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/20130728/270be5da/attachment.html>
More information about the GSoC-PortA
mailing list