Skip to contents

rearrange() 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)

Arguments

x

A numeric matrix, one column per variable.

rotate, seed

The start; at most one.

tolerance

The rise in the smallest row sum below which it stops.

marginals

A list of severities.

p

The VaR level.

n

Quantiles per marginal.

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