qpRndWishart {qpgraph} | R Documentation |
Random generation for the (n.var * n.var
) Wishart distribution (see
Press, 1972) with matrix parameter A=diag(delta)%*%P%*%diag(delta)
and
degrees of freedom df
.
qpRndWishart(delta=1, P=0, df=NULL, n.var=NULL)
delta |
a numeric vector of |
P |
a ( |
df |
degrees of freedom. |
n.var |
dimension of the Wishart matrix. It is required only when both delata and P are scalar. |
The degrees of freedom are df > n.var-1
and the expected value of the
distribution is equal to df * A
. The random generator is based on the
algorithm of Odell and Feiveson (1966).
A list of two n.var * n.var
matrices rW
and meanW
where
rW
is a random value from the Wishart and meanW
is the expected
value of the distribution.
A. Roverato
Odell, P.L. and Feiveson, A.G. A numerical procedure to generate a sample covariance matrix. J. Am. Statist. Assoc. 61, 199-203, 1966.
Press, S.J. Applied Multivariate Analysis: Using Bayesian and Frequentist Methods of Inference. New York: Holt, Rinehalt and Winston, 1972.
Tur, I., Roverato, A. and Castelo, R. Mapping eQTL networks with mixed graphical Markov models. Genetics, 198(4):1377-1393, 2014.
## Construct an adjacency matrix for a graph on 6 vertices nVar <- 6 A <- matrix(0, nVar, nVar) A[1,2] <- A[2,3] <- A[3,4] <- A[3,5] <- A[4,6] <- A[5,6] <- 1 A=A + t(A) A set.seed(123) M <- qpRndWishart(delta=sqrt(1/nVar), P=0.5, n.var=nVar) M set.seed(123) d=1:6 M <- qpRndWishart(delta=d, P=0.7, df=20) M