mvrnorm: Generate draws from a multivariate normal distribution

Description Usage Arguments Details Value Examples

Description

Generate draws from a multivariate normal distribution

Usage

1
mvrnorm(n, mu, Sigma)

Arguments

n

Number of samples.

mu

Mean vector.

Sigma

Covariance matrix.

Details

This is essentially a stripped-down version of the mvrnorm function from the MASS library in R. Through the magic of Rcpp we're transforming the same standard normal draws as the R version. However, since Armadillo follows a different convention from R in its definition of the eign-decomposition, the output of this function will *not* be the same as that of its R counterpart. Since we access R's function for generating normal draws, we can set the seed from R.

Value

Matrix of draws from the normal distribution: each row is a draw.

Examples

1
mvrnorm(10, c(0,0), diag(1, 2, 2))

fditraglia/fmscr documentation built on May 16, 2019, 12:10 p.m.