[GSoC-PortA] Regime Switching

Ross Bennett rossbennett34 at gmail.com
Wed May 28 23:36:10 CEST 2014


All,

I am close to wrapping up adding support for regime switching as per my
proposal. I added a demo so you can see an example of the functionality
(see demo/regime_switching.R).

There is one issue that came up that I would like some input on. The case
is running optimize.portfolio.rebalancing with optimize_method="random".
 If the rp object is not passed in as an argument to
optimize.portfolio.rebalancing, then we try to generate the random
portfolios there so the random portfolios are not (re)generated inside the
loop in optimize.portfolio.

Since the regime portfolio has N portfolios for N regimes, the challenge
here is knowing what portfolio to use for generating the random portfolios
because the constraints could be very different in each portfolio. This
only impacts optimize.portfolio.rebalancing because we do not know the
portfolio specification based on the regime at the time we check the rp
object. We do know inside optimize.portfolio.

The check for rp in optimize.portfolio.rebalancing looks like this
if(optimize_method=="random"){
    if(is.null(rp))
      rp<-random_portfolios(portfolio=portfolio, permutations=search_size)
  }

I have a couple proposed solutions

Solution 1:
Require that the user pass in a random portfolios object for the rp
argument. We don't try to generate random portfolios and we throw an error
if rp is null. We could just use a single rp object or allow for a list of
rp objects with one rp object for each regime portfolio.

Solution 2:
Bypass this check and let optimize.portfolio generate random portfolios for
each regime at each iteration. This is flexible, but could result in very
long run times.

Are there any other solutions I should consider.

Please let me know your thoughts on this.

Thanks,
Ross
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/gsoc-porta/attachments/20140528/ecd358e6/attachment.html>


More information about the GSoC-PortA mailing list