[R-SIG-Finance] Mean-Semivariance (downside risk) Portfolio Construction

Brian G. Peterson brian at braverock.com
Mon Nov 1 15:07:31 CET 2010


Gabe,

Since no one has answered your question regarding fPortfolio, and I 
can't really help with that in this context, I've done an example using 
PortfolioAnalytics.

Here's an example that maximizes Sortino Ratio, given some MAR.

It takes about 15 seconds to run the example on my machine, using 
multicore and random portfolios.  DEoptim will also work, but will be 
slower. Larger portfolios will obviously take longer to optimize.

If you're on Windows, you will have to modify (or simply comment out) 
the lines:
require(doMC)
registerDoMC()

If you want some different objective, let me know, and I can work that 
up too.  This only took a few minutes to put together.

I did have to make some small modifications to the SortinoRatio function 
in PerformanceAnalytics to make it 'portfolio-aware'.  I've attached a 
file you can 'source()' here, and this will be on R-Forge later today, 
and in the next version of PerformanceAnalytics.

There was also a small bug in the plot() method.  I will check in the 
fixed version, and it should be available as a binary download from 
R-Forge at the latest tomorrow.

PortfolioAnalytics, by default, assumes a full investment constraint 
(all weights sum to 1), though this may be turned off if your 
constraints differ.

Regards,

   - Brian


On 10/31/2010 08:19 PM, Gabe Plaxico wrote:
> Brian:
>
> Thanks for the reply. I did come across the PortfolioAnalytics
> (fantastic, by the way) package. I'll have to take a look at it again.
> Last time I used it I was under the impression only one return series
> could be used. I used the result as my max/min target along with a
> Differential Evolution algorithm to see if I could get optimal security
> weights to form an optimized (no shorting) MAR-downside risk portfolio.
> The hang-up is trying to come up with a method to optimize each security
> weight to minimize the downside risk. I couldn't get the algorithm to
> work restricting it to a total weight of 1. I would certainly welcome
> your offer to provide an example if you have come across this before.
> Thanks in advance.
>
> - Gabe
>
> On 10/30/10 7:21 AM, Brian G. Peterson wrote:
>> I can't really help you with fPortfolio in this context, but the
>> PortfolioAnalytics package on R-Forge will do what you need.
>>
>> If you're interested, I could work up a self-contained example for you of
>> SortinoRatio maximization portfolios maybe Monday.
>>
>> Regards,
>>
>> - Brian
>>
>> On Fri, 29 Oct 2010 19:29:38 -0400, Gabe Plaxico<gplaxico at gmail.com>
>> wrote:
>>> Hello Everyone:
>>>
>>> Does anyone have experience in constructing a mean-semivariance
>>> portfolio using the fPortfolio package? What I am really searching for
>>> is the ability to use my own arbitrary "mean", essentially constructing
>>> a downside risk portfolio (Sortino -
>>> http://sortino.com/htm/New%20Book.htm). Typically done using the lpm
>>> solver option. My attempts at constructing this portfolio with
>>> anything other than the true mean for each security ends in an error.
>>> If anyone has done something similar can you provide
>>> suggestions/examples? Thanks in advance.
>>>
>>> _______________________________________________
>>> R-SIG-Finance at stat.math.ethz.ch mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>> -- Subscriber-posting only. If you want to post, subscribe first.
>>> -- Also note that this is not the r-help list where general R questions
>>> should go.


-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: SortinoRatio.R
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20101101/17fd5fb0/attachment.pl>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sortino.R
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20101101/17fd5fb0/attachment-0001.pl>


More information about the R-SIG-Finance mailing list