Skip to contents

Thin extender over mvtnorm::rmvnorm that draws \(n\) observations from the multivariate normal distribution with a given mean vector and covariance matrix.

Usage

morie_mvnorm_sample(n, mean = rep(0, ncol(sigma)), sigma, ...)

Arguments

n

Integer; the number of multivariate observations to draw.

mean

Numeric vector of length ncol(sigma) giving the mean (defaults to a zero vector).

sigma

Numeric positive-(semi)definite covariance matrix.

...

Further arguments forwarded to mvtnorm::rmvnorm (e.g. method, pre0.9_9994, checkSymmetry).

Value

A list with $method = "mvtnorm::rmvnorm" and $raw (a numeric matrix of dimension \(n \times \mathrm{ncol}(\Sigma)\)).

Examples

if (FALSE) { # \dontrun{
  if (requireNamespace("mvtnorm", quietly = TRUE)) {
    set.seed(1)
    S <- matrix(c(1, 0.4, 0.4, 1), 2, 2)
    morie_mvnorm_sample(100, mean = c(0, 0), sigma = S)
  }
} # }