[R-SIG-Finance] Question about the Ulcer Index calculation in PerformanceAnalytics

Eric Berger er|cjberger @end|ng |rom gm@||@com
Mon Mar 8 02:26:56 CET 2021


Hi Ilya,
You  write that UI is a std dev of something, but that is not how it is
defined.
To be a standard deviation, there would have to be a subtraction of a mean
somewhere, and that is not present. (Technically, UI is the square root of
a semivariance.)

I hope that helps,
Eric


On Sun, Mar 7, 2021 at 3:22 PM Ilya Kipnis <ilya.kipnis using gmail.com> wrote:

> I'm working on porting over an interesting risk metric that I found out
> about through a twitter exchange with the usual suspects (Adam Butler of
> ReSolve, Wayne Himelsein) called the Serenity Ratio, found here:
>
>
> https://www.keyquant.com/Download/GetFile?Filename=%5CPublications%5CKeyQuant_WhitePaper_APT_Part1.pdf
>
> Now, I've run into an issue, namely with the calculation of the Ulcer
> Index:
>
> Now, as I understand it, the Ulcer Index is the root-mean-square (read:
> volatility, I.E. standard deviation) of drawdowns. However, when I check
> the UlcerIndex function in R, it uses the DrawdownPeak function, which has
> a different calculation than PerformanceAnalytics:::Drawdowns .
>
> Furthermore, taking the standard deviation of *either*
> PerformanceAnalytics:::Drawdowns *or* DrawdownPeak of returns yields a
> different calculation than using the formal UlcerIndex function.
>
> Here is my script. Can someone explain the choices made with the
> UlcerIndex implementation in the package?
>
> Sample script:
>
> getSymbols('SPY', from = '1990-01-01')
> spyRets <- na.omit(Return.calculate(Ad(SPY)))
> compare <- cbind(PerformanceAnalytics:::Drawdowns(spyRets),
>                  xts(DrawdownPeak(spyRets), order.by = index(spyRets)))
> colnames(compare) <- c("PerfA:::Drawdowns", "DrawdownPeak")
> plot(compare, legend.loc = 'bottomleft')
> differentUIs <- c(StdDev(PerformanceAnalytics:::Drawdowns(spyRets)),
>                   StdDev(DrawdownPeak(spyRets)),
>                   UlcerIndex(spyRets))
> names(differentUIs) <- c("StdDevDrawdowns", "StdDevDDPeak", "UlcerInex")
>
> Outputs:
>
> [image: image.png]
> [image: image.png]
>
> In the interest of replication (I.E. Python has none of these functions in
> any library I know of), and for the correct calculation of other functions
> dependent on the Ulcer Index (UPI, Serenity Ratio), can someone help me
> resolve/understand the discrepancies here?
>
> Thanks so much.
> _______________________________________________
> R-SIG-Finance using r-project.org 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.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20210307/6f180611/attachment.html>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 135986 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20210307/6f180611/attachment.png>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 4696 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20210307/6f180611/attachment-0001.png>


More information about the R-SIG-Finance mailing list