Skip to contents

Every simulation's components rescaled pro rata to a new total: component k in simulation s becomes c[s, k] * totals[s] / sum(c[s, ]) (unchanged when the components sum to 0). This carries a total computed from the components, a loss-ratio cap over several classes or a stop loss on a mix of perils, back onto them in proportion to their shares; it is not a capital allocation. The keys and dimensions are kept.

Usage

scale_to_totals(dist, totals)

Arguments

dist

A predictive_distribution.

totals

One total per simulation.

Examples

pd <- predictive_distribution(matrix(c(6, 3, 9, 1), ncol = 2), data.frame(class = c("motor", "home")))
draw_matrix(scale_to_totals(pd, pmin(rowSums(draw_matrix(pd)), 10)))
#>      [,1] [,2]
#> [1,]    4    6
#> [2,]    3    1