Join predictive distributions into a portfolio
portfolio.Rdjoin_predictive() puts distributions of different models side by side
(a reserve bootstrap by origin, premium risk by line, a tower's net),
with a new leading key column dim holding each part's name, followed by
the union of the parts' key columns ("" where a part lacks one).
Simulation i of the result is simulation i of every part.
reorder_groups() then sets the dependence between the groups of dim
by Iman-Conover on the group totals, moving each group's simulations as
whole rows: every group keeps its distribution and internal joint
structure. Use aggregate(), VaR(), TVaR() and capital_allocation()
on the result.
Usage
join_predictive(parts, dim, same_simulations = FALSE)
reorder_groups(x, dim, correlation, seed)Arguments
- parts
A named list of predictive_distributions with the same number of simulations.
- dim
Name of the new key column.
- same_simulations
FALSE: the parts were simulated separately, and two with the same seed (which would share random numbers) are refused.TRUE: the parts come from the same scenarios (a cover applied to a reserve) and keep their pairing.- x
- correlation
Correlation matrix, one row and column per group in order of first appearance.
- seed
Seed, a whole number.
Examples
a <- predictive_distribution(cbind(c(10, 12), c(20, 25)), data.frame(origin = c(2023, 2024)))
b <- predictive_distribution(matrix(c(50, 40), ncol = 1), data.frame(lob = "motor"))
p <- join_predictive(list(reserve = a, premium = b), "risk")
p@keys
#> risk origin lob
#> 1 reserve 2023
#> 2 reserve 2024
#> 3 premium motor