Command Reference : Function Reference : Function Reference: R
  
 
@rmvnorm
Multivariate normal random draws.
Syntax: @rmvnorm(S[, n])
@rmvnormc(S[, n])
@rmvnormi(S[, n])
@rmvnormic(S[, n])
m: (optional) vector
S: sym, matrix
n: (optional) integer,
Return: vector, matrix
Draw random multivariate normals using the density function.
The multivariate normal density is given by
There are four different forms of the function, corresponding to different ways of specifying . The forms are distinguished by different suffixes that are applied to the base “@rmvnorm” command and how they change the interpretation of the S matrix argument:
 
@rmvnorm
“”
Supply .
@rmvnormc
“c”
Supply the Cholesky decomposition of .
This form is more efficient when performing multiple draws from the same distribution (compute the Cholesky once, but sample many times).
@rmvnormi
“i”
Supply .
This form is more efficient than explicitly inverting to supply .
@rmvnormic
“ic”
Supply the Cholesky decomposition of .
This form combines the efficiencies of the Cholesky and inverse forms.
If the optional argument n is omitted, the function returns a vector containing a single draw from the distribution. If n is provided, n is the number of rows of the returned matrix, with each row representing a draw from the distribution.
Examples
= @dmvnorm(@identity(3))
returns a random draw from a trivariate normal distribution.
Cross-references
See also @dmvnorm.