rand.mnormal: Generate Random Samples from a Multivariate Normal Distribution
Description
Use this function to get random samples from a multivariate normal distribution.
Usage
rand.mnormal(n, mu = NULL, sigma = NULL, p = NULL, byRow = TRUE)
Value
A list containing the generated sample (p x n), mu, and sigma.
Arguments
n
The number of samples to generate.
mu
The mean vector of the distribution.
If NULL, it defaults to a zero vector of length p.
If NA, it is set to a random vector.
sigma
The covariance matrix of the distribution.
If NULL, it defaults to an identity matrix of size p x p.
If NA, it is set to a random positive definite matrix.
p
The dimension of the distribution, if both mu and sigma are NA or NULL.
byRow
If TRUE, generated samples are stored in the rows. Otherwise, they are stored in the columns.