<div dir="ltr">Eric,<br><br>Thanks for the clarification on that part. The one *other* part that has me scratching my head, though, is the use of the DrawdownPeak function, which doesn't have quite the exact same calculations as the usual drawdown curve I'm accustomed to. Is there a reason for using this less common drawdown trajectory calculation, as opposed to the original drawdown curve?<div><br></div><div>-Ilya</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Mar 7, 2021 at 8:27 PM Eric Berger <<a href="mailto:ericjberger@gmail.com">ericjberger@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Ilya,<div>You  write that UI is a std dev of something, but that is not how it is defined. </div><div>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.)</div><div><br></div><div>I hope that helps,</div><div>Eric</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Mar 7, 2021 at 3:22 PM Ilya Kipnis <<a href="mailto:ilya.kipnis@gmail.com" target="_blank">ilya.kipnis@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><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" target="_blank">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" target="_blank">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>
_______________________________________________<br>
<a href="mailto:R-SIG-Finance@r-project.org" target="_blank">R-SIG-Finance@r-project.org</a> mailing list<br>
<a href="https://stat.ethz.ch/mailman/listinfo/r-sig-finance" rel="noreferrer" target="_blank">https://stat.ethz.ch/mailman/listinfo/r-sig-finance</a><br>
-- Subscriber-posting only. If you want to post, subscribe first.<br>
-- Also note that this is not the r-help list where general R questions should go.<br>
</blockquote></div>
</blockquote></div>