rwish {BDgraph} | R Documentation |
Sampling from Wishart distribution
Description
Generates random matrices, distributed according to the Wishart distribution with parameters and
,
.
Usage
rwish( n = 1, p = 2, b = 3, D = diag( p ) )
Arguments
n |
number of samples required. |
p |
number of variables (nodes). |
b |
degree of freedom for Wishart distribution, |
D |
positive definite |
Details
Sampling from Wishart distribution, , with density:
which is the degree of freedom and
is a symmetric positive definite matrix.
Value
A numeric array, say , of dimension
, where each
is a positive
definite matrix, a realization of the Wishart distribution
.
Note, for the case
, the output is a matrix.
Author(s)
Reza Mohammadi a.mohammadi@uva.nl
References
Lenkoski, A. (2013). A direct sampler for G-Wishart variates, Stat, 2:119-128, doi:10.1002/sta4.23
Mohammadi, R. and Wit, E. C. (2019). BDgraph: An R
Package for Bayesian Structure Learning in Graphical Models, Journal of Statistical Software, 89(3):1-30, doi:10.18637/jss.v089.i03
See Also
Examples
sample <- rwish( n = 3, p = 5, b = 3, D = diag( 5 ) )
round( sample, 2 )