Skip to contents

The result every model returns: a matrix of draws with one row per simulation and one column per component, plus one key per component. Components keep their dependence, so the total's quantiles come from row sums. mean(), variance(), quantile(), VaR() and TVaR() describe the total; use marginal() for one component and aggregate() to sum over dimensions.

Usage

predictive_distribution(draws, keys, ptr = NULL)

Arguments

draws

Numeric matrix, n_sims rows by n_components columns.

keys

Data frame with one column per dimension (character or whole numbers) and one row per component.

Value

A predictive_distribution object, which inherits from distribution.

Examples

pd <- predictive_distribution(
  matrix(c(0, 0, 0, 100, 0, 0, 100, 0), ncol = 2),
  data.frame(line = c("A", "B"))
)
VaR(pd, 0.75)
#> [1] 100
VaR(marginal(pd, list(line = "A")), 0.75)
#> [1] 0