Skip to contents

Mirrors the C# MultivariateNormal class of the Numerics library.

Usage

mvdist_normal(
  mean,
  covariance,
  seed = NULL,
  max_evaluations = NULL,
  abs_error = NULL,
  rel_error = NULL,
  decomposition = "Cholesky"
)

Arguments

mean

numeric vector of means, length d.

covariance

a d x d covariance matrix. It must be positive definite for "Cholesky" and may be positive semidefinite for "SingularValue".

seed

optional integer seed for the Genz quasi-Monte-Carlo integrator behind mvdist_cdf() at dimension three and above. NULL uses the reproducible upstream default, 12345. Set a distinct seed when aggregating many instances so their quadrature errors do not share the same lattice shifts.

max_evaluations, abs_error, rel_error

optional integrator tuning; NULL (the default) for each leaves the ported upstream default untouched.

decomposition

covariance factorization, either "Cholesky" (default) or "SingularValue". The latter supports degenerate Gaussian densities on their affine support.

Value

a corehydro_mvdist of family "MultivariateNormal".

Examples

mv <- mvdist_normal(c(0, 0), diag(2))
mvdist_pdf(mv, c(0, 0))
#> [1] 0.1591549