Skip to contents

In simulation i, draws uniforms from copula and applies each marginal's quantile function.

Usage

copula_simulate(copula, marginals, n_sims, seed, keys = NULL)

Arguments

copula

A copula.

marginals

A list of lognormal or grid_distribution objects, one per copula dimension.

n_sims

Number of simulations.

seed

Seed, a whole number.

keys

A data frame with one row per marginal and one column per dimension; defaults to data.frame(component = seq_along(marginals)).

Examples

pd <- copula_simulate(
  gaussian_copula(matrix(c(1, 0.4, 0.4, 1), 2)),
  list(lognormal_from_mean_cv(100, 0.2), lognormal_from_mean_cv(50, 1)),
  n_sims = 10000, seed = 42,
  keys = data.frame(lob = c("motor", "property"))
)
mean(pd)
#> [1] 149.9203