Fast simulation from multivariate Gaussian probability distribution.
rmvnormal(n, mu, sigma)
Returns a \(n\) by \(p\) matrix of observations from a
multivariate normal distribution with the given mean mu
and
covariance
The rmvnormal
function is copied from the GMCM
-package. It is
similar to rmvnorm
from the mvtnorm
-package.
rmvnormal(n = 10, mu = 1:4, sigma = diag(4))
#> [,1] [,2] [,3] [,4]
#> [1,] 0.3396274 0.9434245 2.493076 3.989424
#> [2,] 1.2866435 2.9511507 3.093893 4.751414
#> [3,] 3.6857161 1.6012927 1.796961 5.202637
#> [4,] 1.2132007 2.1696589 2.284323 4.079880
#> [5,] 0.8484295 2.1845110 2.732680 4.022050
#> [6,] 1.2997208 2.4429821 4.068646 3.275814
#> [7,] 3.1325407 0.6456802 4.251484 3.850832
#> [8,] 1.4427332 3.0928139 3.349427 5.172616
#> [9,] 1.4154192 1.7219600 2.510189 3.772807
#> [10,] 2.4041029 2.3811021 2.145886 4.649934