cma_combination: CMA combination Step

View source: R/cma_combination.R

cma_combinationR Documentation

CMA combination Step

Description

Second CMA step: "glue" copulas and marginals into the same data structure.

Usage

cma_combination(x, cdf, copula)

Arguments

x

A rectangular (non-tidy) data structure with the margins.

cdf

A rectangular (non-tidy) data structure with the CDF's.

copula

A rectangular (non-tidy) data structure with the copulas.

Value

A tabular (non-tidy) tibble with the joint scenarios.

See Also

cma_separation

Examples

set.seed(123)

margins <- matrix(stats::rnorm(20), ncol = 2)
colnames(margins) <- c("a", "b")

probs   <- rep(1 / 10, 10)

# separate
sep <- cma_separation(x = margins, p = probs)
# combinate
comb <- cma_combination(margins, sep$cdf, sep$copula)

# The result is identical
margins # matrix

comb # tibble

all.equal(margins[ , "a"], comb$a)
all.equal(margins[ , "b"], comb$b)

Reckziegel/CMA documentation built on July 13, 2022, 10:31 p.m.