Performance Metrics
Sharpe Ratio Style Metrics
Ratios that quantify the risk return trade off, with different risk and return measures.
PerformanceAnalytics.sharperatio
— Functionsharperatio(R::Number,σ::Number,Rf::Number=0.;scale=1)
Calculates the Sharpe Ratio from a given return, standard deviation, and risk free rate.
\[SR=\frac{r_a - r_f}{\sigma_a}\]
sharperatio(R::AbstractArray{<:Number},Rf::Number=0.;scale)
Calculates the Sharpe Ratio from a given return series and a risk free rate.
sharperatio(R::AssetReturn,Rf::Number=0.)
Calculates the annualized Sharpe Ratio.
PerformanceAnalytics.adjustedsharpe
— Functionadjustedsharpe(R::Number,σ::Number,S::Number,K::Number,Rf::Number=0.)
Calculates the Adjusted Sharpe Ratio from Pezier and White (2006) for a preestimated return, standard deviation, skewness, and kurtosis. It adjusts for skewness and kurtosis.
\[AdjSR=SR * [1+\frac{2}{6}*SR - (\frac{K-3}{24})*SR^2]\]
AdjustedSharp(R::AbstractArray{<:Number},Rf::Number=0.;method::AbstractString="population")
Calculates the Adjusted Sharpe Ratio from Pezier and White (2006) for a return series.
method
: specifies the method to be used in the estimation of the Skewness and Kurtosis. Can be one of sample, population, or fisher. Defaults to "population"
AdjustedSharp(R::AbstractArray{<:Number},Rf::Number=0.;method::AbstractString="population")
Calculates the annualized Adjusted Sharpe Ratio from Pezier and White (2006) for a AssetReturn.
method
: specifies the method to be used in the estimation of the Skewness and Kurtosis. Can be one of sample, population, or fisher. Defaults to "population"
PerformanceAnalytics.treynorratio
— Functiontreynorratio(Ra::AbstractArray{<:Number},Rb::AbstractArray{<:Number},Rf::Number=0;modified::Bool=false,scale=1)
Scale argument used to annualize all numbers for daily data use 252 (default is 1), for monthly 12, etc.
SharpeRatio that uses beta as risk rather than the assets standard deviation of returns. The modified TreynorRatio uses the systematic risk rather than the beta.
\[TreynorRatio = \frac{\frac{1}{n}\times\sum_{t=1}^n (r_{a,t}-r_{f,t})}{\beta_{r_a,r_b}}\]
\[ModifiedTreynorRatio = \frac{\frac{1}{n}\times\sum_{t=1}^n (r_{a,t}-r_{f,t})}{\beta_{r_a,r_b}\times std(R_b)}\]
treynorratio(Ra::AssetReturn,Rb::AssetReturn,Rf::Number=0;modified::Bool=false)
Calculates the Treynor Ratio.
PerformanceAnalytics.kappa
— Functionkappa(R::AbstractArray{<:Number},MAR::Number=0.,k::Number=2)
If k=1 this returns the Sharpe-Omega Ratio. If k=2 this returns the Sortino Ratio
\[Kappa = \frac{r-MAR}{\sqrt[k]{\frac{1}{n}*\sum_{t=1}^nmax(MAR - r_t,0)^k}}\]
kappa(R::AssetReturn,MAR::Number=0.;k::Number=2)
If k=1 this returns the Sharpe-Omega Ratio. If k=2 this returns the Sortino Ratio
PerformanceAnalytics.appraisalratio
— Functionappraisalratio(Ra::AbstractArray{<:Number},Rb::AbstractArray{<:Number},Rf::Number=0,method::AbstractString = "appraisal",scale::Number=1)
Jensen's Alpha adjusted for risk. The modified
version uses β as the risk measure. The appraisal
version uses specific risk. The alternative
version uses systematic risk.
\[\frac{\alpha}{risk measure}\]
appraisalratio(Ra::AssetReturn,Rb::AssetReturn,Rf::Number=0;method::AbstractString = "appraisal")
Jensen's Alpha adjusted for risk.
PerformanceAnalytics.informationratio
— Functioninformationratio(Ra::AbstractArray{<:Number},Rb::AbstractArray{<:Number},scale::Number=1)
Calculates the Information Ratio. It is defined as the Active Premium over the Tracking Error. The tracking error needs to be annualized therefore it is important to specify the periodecity of the data with scale.
\[InformationRatio(Ra,Rb,scale) = \frac{ActivePremium(r_a,r_b,scale)}{TrackingError(r_a,r_b,scale)} = \frac{(1+\overline{r_a})^{scale}- (1+\overline{r_b})^{scale}}{\sqrt{\sum_{t=1}^n\frac{(r_{a,t} -r_{b,t})^2}{n\times\sqrt{scale}}}}\]
informationratio(Ra::AssetReturn,Rb::AssetReturn)
Calculates the Information Ratio. It is defined as the Active Premium over the Tracking Error.
Drawdown Based Metrics
PerformanceAnalytics.burkeratio
— Functionburkeratio(Ra::AbstractArray{<:Number}, Drawdowns::AbstractArray{<:Number};Rf::Number=0.,scale=1)
Calculates the Burke Ratio from a return series, a risk free rate, and drawdowns.
\[BurkeRatio = \frac{r_a-r_f}{\sqrt{\sum_{t=1}^{d}D_t^2}}\]
burkeratio(R::AbstractArray{<:Number}; Rf::Float64 = 0., modified::Bool = false, scale::Number=1)
Calculates the Burke Ratio from a return series and a risk free rate.
Arguments
- Ra is a vector of returns.
- Rf is a risk free rate
- modified adjusted for the number of drawdowns (default is false)
- scale to annualize (default to 1)
burkeratio(AR::AssetReturn; Rf::Float64 = 0., modified::Bool = false)
Calculates the Burke Ratio from a return series and a risk free rate.
Arguments
- Ra is a vector of returns.
- Rf is the risk free rate.
- modified adjusted for the number of drawdowns (default is false)
PerformanceAnalytics.calmarratio
— Functioncalmarratio(R::AbstractArray{<:Number},scale::Float64=1.)
Risk return metric. Gives the annualized return divided by the maximum drawdown. scale
is the scaling factor used to annualize returns (defaults tol 1.)
\[CalmarRatio = \frac{r_a}{maxDD}\]
calmarratio(R::AssetReturn)
Risk return metric. Gives the annualized return divided by the maximum drawdown.
Misc
PerformanceAnalytics.jensensalpha
— Functionjensensalpha(Y::AbstractArray{<:Number},X::AbstractArray{<:Number}...;scale::Number=1)
Returns the annualized Jensens Alpha.
Arguments
Y
the assets returnX
the benchmark returnscale
the scaling number used to annualize returns (defaults to 1)
jensensalpha(Y::AssetReturn,X::AssetReturn...)
Returns the annualized Jensens Alpha.
PerformanceAnalytics.bernardoledoitratio
— Functionbernardoledoitratio(R::AbstractVector{<:Number})
Calculates the Bernardo Ledoit ratio for a return series.
\[Bernardo Ledoit Ratio = \frac{\frac{1}{n}\sum_{t=1}^{n}max(r_t,0)}{\frac{1}{n}\sum_{t=1}^{n}max(-r_t,0)}\]
bernardoledoitratio(R::AssetReturn)
Calculates the Bernardo Ledoit ratio for a AssetReturn.
PerformanceAnalytics.hurstindex
— Functionhurstindex(R::AbstractArray{<:Number})
Measures whether returns are random, peristent, or mean reverting.
- 0 to 0.5: mean reverting
- 0.5: random
- 0.5 to 1: persistent
\[HurstIndex = \frac{log(\frac{[max(r) - min(r)]}{\sigma})}{log(n)}\]
hurstindex(R::AssetReturn)
Measures whether returns are random, peristent, or mean reverting.