Skip to contents

Risk ratios of a per-simulation result such as a margin, where large is good, about a threshold t and under named conventions: "Sharpe" is (mean - t) / sd with the population SD; "Sortino" is (mean - t) over the downside risk sortino names; "Omega" is the ratio omega names; "TVaR ratio <q>" is (mean - t) / TVaR_q(-x), the TVaR of the result read as a loss (STARR), negative when even the worst outcomes are above zero. A zero denominator gives Inf or -Inf, or NaN when the numerator is 0 too.

Usage

risk_ratios(
  x,
  threshold = 0,
  sortino = "downside_deviation",
  omega = "partial_moments",
  tvar_levels = 99,
  tvar = "exact"
)

Arguments

x

A numeric vector of draws, a sampled or a predictive_distribution (one row per component).

threshold

The threshold t.

sortino

"downside_deviation" (the default: sqrt(mean(pmin(x - t, 0)^2)) over all simulations) or "below_threshold_sd" (the population SD of the values below t only, as a reference pricing model computes it; NaN when none is).

omega

"partial_moments" (the default: mean(pmax(x - t, 0)) / mean(pmax(t - x, 0))) or "count" (sum(x > t) / sum(x < t); values equal to t count in neither).

tvar_levels

TVaR levels in percent.

tvar

"exact" (the default), "linear" or "whole_years", as for statistics().

Value

For draws or a sampled, a named numeric vector. For a predictive_distribution, its keys data frame with one column per ratio.

Examples

risk_ratios(c(-2, -1, 1, 2, 5), sortino = "below_threshold_sd", omega = "count")
#>        Sharpe       Sortino         Omega TVaR ratio 99 
#>     0.4082483     2.0000000     1.5000000     0.5000000