Skip to contents

The components whose value on dimension dim is one of keys, with every dimension and the draws' joint structure kept. Take one part of a result this way before joining it to another: select_components(apply_tower(...), "kind", "ceded") is a treaty's cession, ready to add to a book with join_predictive(). Aggregating over kind instead adds gross, ceded and net together.

Usage

select_components(dist, dim, keys)

Arguments

dist

A predictive_distribution.

dim

The dimension's name.

keys

Values on that dimension (character or whole numbers).

Examples

pd <- predictive_distribution(matrix(c(10, 4, 3, 0, 7, 4), ncol = 3),
  data.frame(kind = c("gross", "ceded", "net"), layer = c("ground_up", "5x5", "retained")))
mean(select_components(pd, "kind", "ceded"))
#> [1] 1.5