rgwish {BDgraph}  R Documentation 
Generates random matrices, distributed according to the GWishart distribution with parameters b and D, W_G(b, D) with respect to the graph structure G. Note this fuction works for both nondecomposable and decomposable graphs.
rgwish( n = 1, adj = NULL, b = 3, D = NULL, threshold = 1e8 )
n 
The number of samples required. 
adj 
The adjacency matrix corresponding to the graph structure which can be nondecomposable or decomposable. It should be an upper triangular matrix in which a_{ij}=1
if there is a link between notes i and j, otherwise a_{ij}=0.

b 
The degree of freedom for GWishart distribution, W_G(b, D). 
D 
The positive definite (p \times p) "scale" matrix for GWishart distribution, W_G(b, D). The default is an identity matrix. 
threshold 
The threshold value for the convergence of sampling algorithm from GWishart. 
Sampling from GWishart distribution, K \sim W_G(b, D), with density:
Pr(K) \propto K ^ {(b  2) / 2} \exp ≤ft\{ \frac{1}{2} \mbox{trace}(K \times D)\right\},
which b > 2 is the degree of freedom and D is a symmetric positive definite matrix.
A numeric array, say A, of dimension (p \times p \times n), where each A[,,i] is a positive definite matrix, a realization of the GWishart distribution, W_G(b, D). Note, for the case n=1, the output is a matrix.
Reza Mohammadi a.mohammadi@uva.nl
Lenkoski, A. (2013). A direct sampler for GWishart variates, Stat, 2:119128
Mohammadi, R. and Wit, E. C. (2019). BDgraph: An R
Package for Bayesian Structure Learning in Graphical Models, Journal of Statistical Software, 89(3):130
Mohammadi, A. and Wit, E. C. (2015). Bayesian Structure Learning in Sparse Gaussian Graphical Models, Bayesian Analysis, 10(1):109138
Letac, G., Massam, H. and Mohammadi, R. (2018). The Ratio of Normalizing Constants for Bayesian Graphical Gaussian Model Selection, arXiv preprint arXiv:1706.04416v2
Mohammadi, A. et al (2017). Bayesian modelling of Dupuytren disease by using Gaussian copula graphical models, Journal of the Royal Statistical Society: Series C, 66(3):629645
# Generating a 'circle' graph as a nondecomposable graph adj < graph.sim( p = 5, graph = "circle" ) adj # adjacency of graph with 5 nodes sample < rgwish( n = 1, adj = adj, b = 3, D = diag( 5 ) ) round( sample, 2 ) sample < rgwish( n = 5, adj = adj ) round( sample, 2 )