Last data update: 2014.03.03

R: Random number generation from the multivariate normal...
rmnormR Documentation

Random number generation from the multivariate normal distribution

Description

This function is a speed-optimised version of the rmnorm function from the mnormt package of Adelchi Azzalini (2013).

Usage

rmnorm(n, mean = NULL, vcov = 1)

Arguments

n

integer, the number of observations to generate

mean

numeric vector, i.e. the mean values

vcov

numeric matrix, i.e. the variance-covariance matrix

Details

Empty

Value

A matrix of n rows

Author(s)

Genaro Sucarrat, http://www.sucarrat.net/

References

Adelchi Azzalini (2013): 'mnormt: The multivariate normal and t distributions', R package version 1.4-7, http://CRAN.R-project.org/package=mnormt

Examples

##generate from univariate standardised normal:
z1 <- rmnorm(100)

##generate from bivariate, independent standardised normal:
z2 <- rmnorm(100, vcov=diag(c(1,1)))

##generate from bivariate, dependent standardised normal:
z3 <- rmnorm(100, vcov=cbind(c(1,0.3),c(0.3,1)))

Results