[R-SIG-Finance] PerformanceAnalytics and the UpsidePotentialRatio
Brian G. Peterson
brian at braverock.com
Tue Sep 30 23:14:55 CEST 2008
Ryan,
I've updated the code to allow the use of a "method" argument for all
the related functions. I was wondering if I could impose upon you to
check my understanding of something.
In June of 2007, I committed changes to the DownsideDeviation function
with the comment: "fixed to use length of entire series, per Platinga,
van der Meer, Sortino 2001", and in August 2007, I added the method
argument so that users could choose.
If you have the time and inclination, would you be willing to take a
look at the reference and see if yourread of the paper matches my
understanding that the length of the full series should be the default?
Plantinga, A., van der Meer, R. and Sortino, F. The Impact of Downside
Risk on Risk-Adjusted Performance of Mutual Funds in the Euronext
Markets. July 19, 2001. Available at SSRN:
http://ssrn.com/abstract=277352
I'm mostly concerned with setting the best default here. All the
functions now support the method argument, I just want to make sure that
the default is as rational as possible. I've copied the list in case
any one else wants to chime in as well.
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