Skip to contents

Restricts a mvdist_normal() to a subset of its dimensions. Available for "MultivariateNormal" only; every other family errors naming itself, not a raw C++ throw.

Usage

mvdist_marginal(mv, indices)

Arguments

mv

a corehydro_mvdist of family "MultivariateNormal".

indices

the 1-based dimensions to keep.

Value

a corehydro_mvdist over those dimensions.

Details

The returned distribution inherits mv's Genz integrator settings: seed, max_evaluations, abs_error, and rel_error all carry over. A seeded parent therefore gives a seeded child, whose mvdist_cdf() above dimension two is reproducible and agrees between R and Python. A parent left clock-seeded gives a clock-seeded child.

Examples

mvdist_mean(mvdist_marginal(mvdist_normal(c(1, 2, 3), diag(3)), c(1, 3)))
#> [1] 1 3