Skip to contents

VaR(dist, p) is the inverted empirical distribution function; TVaR(dist, p) is the mean of the worst 1 - p, splitting the draw at the VaR so it is coherent and continuous in p. For a predictive_distribution both describe the total over all components. For a parametric severity or a grid_distribution, VaR() is the lower quantile, as quantile(), and a severity's TVaR() is VaR(p) + E[(X - VaR(p))+] / (1 - p), infinite where the mean is. For a sampled, method = "linear" picks the other convention: VaR() is then quantile(x, p, type = 7) (numpy's default) and TVaR() the mean of that quantile function over [p, 1]; the defaults are "inverted_cdf" and "exact". method = "kth_largest" makes VaR() the k-th largest draw and method = "whole_years" makes TVaR() the mean of the k largest, k = max(1, floor((1 - p) n)): with years as draws, the k-th worst year and the mean of the k worst whole years, the convention of many catastrophe pricing teams. The k-th largest is one draw above "inverted_cdf" (unless both are the largest), and the whole years' TVaR equals "exact" when (1 - p) n is whole.

Usage

VaR(dist, p, ...)

TVaR(dist, p, ...)

Arguments

dist

A sampled, predictive_distribution, pot_tail, grid_distribution, or a severity (lognormal, pareto and the other parametric families).

p

Probabilities in [0, 1] ([0, 1) for a severity's TVaR()).

...

For a sampled, method: "inverted_cdf", "linear" or "kth_largest" for VaR(), "exact", "linear" or "whole_years" for TVaR(). Otherwise unused.

Value

Numeric vector the length of p.

Examples

s <- sampled(c(1, 2, 3, 4))
VaR(s, 0.5)
#> [1] 2
TVaR(s, 0.5)
#> [1] 3.5