To calculate Martin ratio we divide the difference of the portfolio return and the risk free rate by the Ulcer index
MartinRatio(R, Rf = 0, ...)$$Martin ratio = \frac{r_P - r_F}{\sqrt{\sum^{n}_{i=1} \frac{{D'_i}^2}{n}}}$$
where \(r_P\) is the annualized portfolio return, \(r_F\) is the risk free rate, \(n\) is the number of observations of the entire series, \(D'_i\) is the drawdown since previous peak in period i
Carl Bacon, Practical portfolio performance measurement and attribution, second edition 2008 p.91
data(portfolio_bacon)
print(MartinRatio(portfolio_bacon[,1])) #expected 1.70
#> portfolio.monthly.return....
#> Ulcer Index 1.70772
data(managers)
print(MartinRatio(managers['1996']))
#> HAM1 HAM2 HAM3 HAM4 HAM5 HAM6 EDHEC LS EQ
#> Martin Ratio (Rf = 0) 15.49888 16390.63 19.24429 13.67313 NA NA NA
#> SP500 TR US 10Y TR US 3m TR
#> Martin Ratio (Rf = 0) 14.81878 0.01003279 Inf
print(MartinRatio(managers['1996',1]))
#> HAM1
#> Ulcer Index 15.49888