Command Reference : Matrix Language Reference
  
 
@rmvnorm
Multivariate normal random draws.
Syntax: @rmvnorm(S, n)
@rmvnormc(S, n)
@rmvnormi(S, n)
@rmvnormic(S, n)
S: sym, matrix
n: integer,
Return: 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
sym a = @inner(@mnrnd(100, 10))
matrix x = @rmvnorm(a, 500)
x = @rmvnormc(@cholesky(a))
x = @rmvnormi(@inverse(a))
x = @rmvnormic(@cholesky(@inverse(a))
Cross-references
See also rmvnorm, @mnrnd, nrnd, and rnd.