randmvn {monomvn} | R Documentation |
Randomly generate a mean vector and covariance matrix describing a multivariate normal (MVN) distribution, and then sample from it
randmvn(N, d)
N |
number of samples to draw |
d |
dimension of the MVN, i.e., the length of the mean vector and the number of rows/cols of the covariance matrix |
The components of the mean vector mu
are iid from a
standard normal distribution, and the covariance matrix S
is
drawn from an inverse–Wishart distribution with degrees of freedom
d + 2
and mean (centering matrix) diag(d)
The return value is a list
with the following components:
mu |
randomly generated mean vector of length d |
S |
randomly generated covariance matrix with d
rows and d columns |
x |
if N > 0 then x is an N by d
matrix of N samples from the MVN with mean vector
mu and covariance matrix S ; otherwise when
N = 0 this component is not included |
requires the rmvnorm
function of the
mvtnorm package
Robert B. Gramacy bobby@statslab.cam.ac.uk
randmvn(5, 3)