The Rearrangement Algorithm and the worst VaR of a sum
rearrange.Rdrearrange() is Puccetti and Rueschendorf's algorithm: it orders each
column of x opposite to the sum of the others until the smallest row sum
stops rising by tolerance. worst_var() applies it to n quantiles of
each marginal from p up (Embrechts, Puccetti and Rueschendorf's lower
matrix) to estimate the worst VaR at p of their sum under unknown
dependence (Pricing Insurance Risk, Exercise 59). It is a heuristic
whose answer depends on the start: as given, column j rotated down by
rotate * j places, or each column shuffled from seed.
Usage
rearrange(x, rotate = NULL, seed = NULL, tolerance = 1e-06)
worst_var(marginals, p, n = 100, rotate = NULL, seed = NULL, tolerance = 1e-06)Value
A list with value (the smallest row sum, the worst VaR
estimate), columns (the final arrangement as a matrix) and
iterations.
Examples
rearrange(cbind(1:4, 1:4))$value
#> [1] 5
m <- lapply(c(1, 2, 3), function(cv) lognormal_from_mean_cv(10, cv))
worst_var(m, 0.99, n = 40, rotate = 19)$value
#> [1] 352.8734