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

Ilya Kipnis ||y@@k|pn|@ @end|ng |rom gm@||@com
Sun Mar 7 21:22:16 CET 2021


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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20210307/c483ac51/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/c483ac51/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/c483ac51/attachment-0001.png>


More information about the R-SIG-Finance mailing list