[R-SIG-Finance] PerformanceAnalytics and the UpsidePotentialRatio

Brian G. Peterson brian at braverock.com
Tue Sep 30 20:59:04 CEST 2008


Ryan,

We previously encountered this problem in the DownsideDeviation
function.  When looking at Sortino's various writings on the subject, we
found that both interpretations (full series versus subset series) had
been used in published papers.  

For DownsideDeviation, we implemented a "method" argument to allow the
user to choose a "full" or "subset" series to be applied to the
calculation, but did not carry that through to UpsidePotentialRatio.

I'll give it some thought and extend the "method" argument to the
UpsidePotentialRatio function as well.  I'll try to post a patched
function here that supports the "method" argument soon.

Thank you very much for your thoughtful comments:  questions,
suggestions, and reports from users improve PerformanceAnalytics for all
of us.  Keep it coming!

Regards,

   - Brian

On Tue, 2008-09-30 at 14:36 -0400, ryan.sheftel at malbecpartners.com
wrote:
> 
> Continuing to look at the PerformanceAnalytic package and this time
> the function UpsidePotentialRatio 
> 
> The code in the package is: 
> 
> > UpsidePotentialRatio 
> function (Ra, MAR = 0) 
> { 
>     Ra = checkData(Ra, method = "vector") 
>     r = subset(Ra, Ra > MAR) 
>     return((sum(r - MAR)/(length(Ra)))/DownsideDeviation(Ra, MAR)) 
> } 
> 
> I believe there are two problems with this calculation according to my
> understanding of the ratio. 
> 
> - I think the numerator should be the average return of the
> observations in excess of the MAR, so the lenght(Ra) should be
> lenght(r). 
> 
>         (sum(r - MAR)/(length(r))) 
> 
> - Second the denominator should the the deviation below the MAR, but
> again only for the observations below the MAR. The DownsideDeviation
> function looks to again be using all observations: 
> 
> > DownsideDeviation 
> function (Ra, MAR = 0) 
> { 
>     Ra = checkDataVector(Ra) 
>     r = subset(Ra, Ra < MAR) 
>     return(sqrt(sum((r - MAR)^2)/(length(Ra)))) 
> } 
> 
> In here the final "length(Ra)" should be "length(r)" 
> 
> 
> Thanks for taking a look. The package is very impressive.



More information about the R-SIG-Finance mailing list