rmvn | R Documentation |
Simulate draws from the multivariate normal distribution.
rmvn(n = 1, mu, sigma = diag(rep(1., length(mu))))
n |
The desired number of draws. |
mu |
The mean of the distribution. A vector. |
sigma |
The variance matrix of the distribution. A matrix. |
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.
If n == 1
the return value is a vector. Otherwise it is
a matrix with n
rows and length(mu)
columns.
Steven L. Scott steve.the.bayesian@gmail.com
y1 <- rnorm(1, 1:3)
## y1 is a vector
y2 <- rnorm(10, 1:3)
## y2 is a matrix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.