| rmvnorm | R Documentation |
An internal utility to simulate from a MVN distribution. By using a pivoted Cholesky decomposition, the function can handle semi-definite covariance matrices by effectively reducing the dimensionality to the numerical rank of the matrix.
rmvnorm(n, mu, Sig)
n |
Integer; the number of samples to generate. |
mu |
Numeric vector; the mean vector of length |
Sig |
Numeric matrix; the |
The function extracts the pivoting index and the numerical rank from
the result of chol(Sig, pivot = TRUE). It then generates
independent standard normal draws of dimension r (the rank)
and transforms them using the Cholesky factor to match the target
covariance and mean.
A matrix of dimension n x p where each row is a
random draw from the specified MVN distribution.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.