rgwish: Sampling from G-Wishart distribution

Description Usage Arguments Details Value Author(s) References Examples

Description

Generates random matrices, distributed according to the G-Wishart distribution with parameters b and D, W_G(b, D).

Usage

1
rgwish( n = 1, adj.g = NULL, b = 3, D = NULL )

Arguments

n

The number of samples required.

adj.g

The adjacency matrix corresponding to the graph structure. 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 G-Wishart distribution, W_G(b, D).

D

The positive definite (p \times p) "scale" matrix for G-Wishart distribution, W_G(b, D). The default is an identity matrix.

Details

Sampling from G-Wishart 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.

Value

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 G-Wishart distribution, W_G(b, D).

Author(s)

Abdolreza Mohammadi and Ernst Wit

References

Lenkoski, A. (2013). A direct sampler for G-Wishart variates, Stat, 2:119-128

Mohammadi, A. and E. Wit (2015). Bayesian Structure Learning in Sparse Gaussian Graphical Models, Bayesian Analysis, 10(1):109-138

Mohammadi, A. and E. Wit (2015). BDgraph: An R Package for Bayesian Structure Learning in Graphical Models, arXiv:1501.05108

Mohammadi, A. et al (2017). Bayesian modelling of Dupuytren disease by using Gaussian copula graphical models, Journal of the Royal Statistical Society: Series C

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
graph.sim <- bdgraph.sim( p = 5, graph = "cycle" )
adj.g     <- graph.sim $ G
adj.g    # adjacency of graph with 5 nodes and 4 links
   
sample <- rgwish( n = 3, adj.g = adj.g, b = 3, D = diag(5) )
round( sample, 2 )  

## End(Not run)


Search within the BDgraph package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.