randmvn | R Documentation |
Randomly generate a mean vector and covariance matrix describing a multivariate normal (MVN) distribution, and then sample from it
randmvn(N, d, method = c("normwish", "parsimonious"),
mup=list(mu = 0, s2 = 1), s2p=list(a = 0.5, b = 1),
pnz=0.1, nu=Inf)
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 |
method |
the default generation method is |
mup |
a |
s2p |
a |
pnz |
a scalar |
nu |
a scalar |
In the direct method ("normwish"
) 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)
In the "parsimonious"
method mu
and S
are
built up sequentially by randomly sampling intercepts, regression
coefficients (of length i-1
for i in 1:d
) and variances
by applying the monomvn
equations. A unique prior results
when a random number of the regression coefficients are set to zero.
When none are set to zero the direct method results
The return value is a list
with the following components:
mu |
randomly generated mean vector of length |
S |
randomly generated covariance |
x |
if |
requires the rmvnorm
function of the
mvtnorm package
Robert B. Gramacy rbg@vt.edu
rwish
, rmvnorm
,
rmono
randmvn(5, 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.