<div dir="ltr"><div dir="ltr"><div>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:</div><div><br></div><div><a href="https://www.keyquant.com/Download/GetFile?Filename=%5CPublications%5CKeyQuant_WhitePaper_APT_Part1.pdf">https://www.keyquant.com/Download/GetFile?Filename=%5CPublications%5CKeyQuant_WhitePaper_APT_Part1.pdf</a><br><br>Now, I've run into an issue, namely with the calculation of the Ulcer Index:</div><div dir="ltr"><br></div><div dir="ltr">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 .  <br><br>Furthermore, taking the standard deviation of *either* PerformanceAnalytics:::Drawdowns *or* DrawdownPeak of returns yields a different calculation than using the formal UlcerIndex function.  <br><br>Here is my script. Can someone explain the choices made with the UlcerIndex implementation in the package?  <br><br>Sample script:<div><br></div><div><div>getSymbols('SPY', from = '1990-01-01')</div><div>spyRets <- na.omit(Return.calculate(Ad(SPY)))</div><div>compare <- cbind(PerformanceAnalytics:::Drawdowns(spyRets), </div><div>                 xts(DrawdownPeak(spyRets), <a href="http://order.by">order.by</a> = index(spyRets)))</div><div>colnames(compare) <- c("PerfA:::Drawdowns", "DrawdownPeak")</div><div>plot(compare, legend.loc = 'bottomleft')</div><div>differentUIs <- c(StdDev(PerformanceAnalytics:::Drawdowns(spyRets)),</div><div>                  StdDev(DrawdownPeak(spyRets)),</div><div>                  UlcerIndex(spyRets))</div><div>names(differentUIs) <- c("StdDevDrawdowns", "StdDevDDPeak", "UlcerInex")</div></div><div><br></div><div>Outputs:</div><div><br></div><div><img src="cid:ii_klzlmv220" alt="image.png" width="542" height="317"><br></div><div><img src="cid:ii_klzln7531" alt="image.png" width="460" height="62"><br></div><div><br></div><div>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?<br><br>Thanks so much.</div></div></div></div>