Skip to contents

Each item read at the driver's mean, percentiles and TVaRs: the item's value on the simulation the driver's statistic selects, as a results table reports a commission or a margin "at" each percentile of the loss ratio. With o the driver's stable ascending order (order(driver): ties keep simulation order) and h = q (n - 1) for a level q in percent over 100, "Mean" is the item on the first o[i] whose driver is at or above the driver's mean, "Percentile <q>" the item on o[i] with i from h by rule (0-based), and "TVaR <q>" the item's mean over o[ceiling(h):] whatever the rule.

Usage

co_statistics(
  items,
  driver,
  percentiles,
  tvar_levels = c(99, 99.5, 99.6, 99.8, 99.9, 99.99),
  rule = "round_half_even"
)

Arguments

items

A predictive_distribution (every component is read), or a named list or data frame of numeric vectors of equal length.

driver

The driver's draws; for a predictive_distribution also a component's key as a named list (as marginal() takes it), or NULL for its total.

percentiles

Percentiles, in percent, in [0, 100].

tvar_levels

TVaR levels in percent.

rule

"round_half_even" (the default: halves to the even index, as R's round() and Python's do), "floor" or "ceil".

Value

A data frame: for a predictive_distribution its keys with one column per statistic, otherwise an item column and one column per statistic.

Examples

ulr <- c(0.6, 0.9, 0.5, 0.7, 0.8)
co_statistics(list(margin = c(0.3, 0, 0.4, 0.2, 0.1)), ulr, 62.5, tvar_levels = 62.5)
#>     item Mean Percentile 62.5 TVaR 62.5
#> 1 margin  0.2             0.2      0.05