Learn R Programming

stm (version 1.3.3)

rmvnorm: Draw from a Multivariate Normal

Description

A basic function for doing multivariate normal simulations via the cholesky decomposition of the covariance matrix. Function is based on one by Peter Hoff.

Usage

rmvnorm(n, mu, Sigma, chol.Sigma = chol(Sigma))

Arguments

n

number of draws

mu

the K-dimensional mean

Sigma

the K by K dimensional positive definite covariance matrix

chol.Sigma

the cholesky decomposition of the Sigma matrix.

Details

This is a pretty standard multivariate normal generator. It could almost certainly be faster if we ported it over to RcppArmadillo but it isn't used a ton at the moment.