powered by
This function draws from a multivariate normal distribution.
rmvnorm(n = 1, mean, Sigma, log = FALSE)
If n = 1 a vector of length p, else a matrix of dimension n times p with samples as rows.
n = 1
vector
p
matrix
n
An integer, the number of samples.
integer
A numeric, the mean vector of length p.
numeric
A matrix, the covariance matrix of dimension p x p.
A logical, if TRUE the draw is taken from the log-normal distribution. By default, log = FALSE.
logical
TRUE
log = FALSE
mean <- c(0, 0) Sigma <- diag(2) rmvnorm(n = 3, mean = mean, Sigma = Sigma) rmvnorm(mean = mean, Sigma = Sigma, log = TRUE)
Run the code above in your browser using DataLab