rmvnorm_cholesky: Generate multivariate Normals

Description Usage Arguments Details Value See Also Examples

View source: R/multivariatenormal.R

Description

Function to generate draws from a multivariate Normal distribution, given Cholesky factor of the covariance.

Usage

1
rmvnorm_cholesky(n, mean, cholesky)

Arguments

n

is the number of desired samples

mean

is the mean vector

cholesky

is the cholesky factor of the covariance matrix, obtained e.g. with chol().

Details

This function does not check anything (i.e. that the given covariance is PSD). Thus it is faster than functions in standard packages, but more risky.

Value

a n x d matrix where d is both the length of mean and the dimension of cholesky. Each row contains a draw from the desired multivariate Normal.

See Also

rmvnorm, dmvnorm, dmvnorm_cholesky_inverse

Examples

1
rmvnorm_cholesky(10, rep(0, 5), chol(diag(1, 5, 5)))

pierrejacob/PET documentation built on May 25, 2019, 11:35 p.m.