powered by
A shim of mvrnorm to return matrix when n < 2.
mvrnorm
rmvn(n = 1L, mu, Sigma, ...)
A matrix with n rows and length(mu) columns.
n
length(mu)
number of random vectors desired (nonnegative integer, can be 0).
mean vector.
variance-covariance matrix.
other arguments passed to mvrnorm.
Peter Solymos
rmvn(0, c(a=0, b=0), diag(1, 2, 2)) rmvn(1, c(a=0, b=0), diag(1, 2, 2)) rmvn(2, c(a=0, b=0), diag(1, 2, 2)) sapply(0:10, function(n) dim(rmvn(n, c(a=0, b=0), diag(1, 2, 2))))
Run the code above in your browser using DataLab