rand.mnormal {ldt} | R Documentation |
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)
Arguments
n |
The number of samples to generate. |
mu |
The mean vector of the distribution.
If |
sigma |
The covariance matrix of the distribution.
If |
p |
The dimension of the distribution, if both |
byRow |
If |
Value
A list containing the generated sample (p x n
), mu
, and sigma
.
Examples
s1 <- rand.mnormal(10, mu = c(0, 0), sigma = matrix(c(1, 0.5, 0.5, 1), ncol = 2))
s2 <- rand.mnormal(10, mu = c(1,1), sigma = NA, p = 2)
s3 <- rand.mnormal(10, p = 2, byRow = FALSE) #standard normal
[Package ldt version 0.5.3 Index]