powered by
Simulate draws from the multivariate normal distribution.
rmvn(n = 1, mu, sigma = diag(rep(1., length(mu))))
If n == 1 the return value is a vector. Otherwise it is a matrix with n rows and length(mu) columns.
n == 1
n
length(mu)
The desired number of draws.
The mean of the distribution. A vector.
The variance matrix of the distribution. A matrix.
Steven L. Scott steve.the.bayesian@gmail.com
Note that mu and sigma are the same for all n draws. This function cannot handle separate parameters for each draw the way rnorm and similar functions for scalar random variables can.
mu
sigma
rnorm
y1 <- rnorm(1, 1:3) ## y1 is a vector y2 <- rnorm(10, 1:3) ## y2 is a matrix
Run the code above in your browser using DataLab