rmvn: Simulate multivariate normal

View source: R/simulations.r

rmvnR Documentation

Simulate multivariate normal

Description

Simulate from a multivariate normal distribution.

Usage

rmvn(n, mu = 0, cov = matrix(1))

Arguments

n

Number of simulation replicates.

mu

Mean vector.

cov

Variance-covariance matrix.

Details

Uses the Cholesky decomposition of the matrix cov, obtained by base::chol().

Value

A matrix of size n x length(mu). Each row corresponds to a separate replicate.

See Also

stats::rnorm()

Examples

rmvn(100, c(1, 2), matrix(c(1, 1, 1, 4), ncol = 2))

lukehannan/lumisc documentation built on May 9, 2022, 12:59 p.m.