powered by
Simulate from a multivariate normal distribution.
rmvn(n, mu = 0, V = matrix(1))
A matrix of size n x length(mu). Each row corresponds to a separate replicate.
length(mu)
Number of simulation replicates.
Mean vector.
Variance-covariance matrix. If a single number, we take it to be the correlation between all pairs, in which case the variances are taken to be 1.
Uses the Cholesky decomposition of the matrix V, obtained by base::chol().
V
base::chol()
stats::rnorm()
x <- rmvn(100, c(1,2),matrix(c(1,1,1,4),ncol=2))
Run the code above in your browser using DataLab