| bdgraph.sim {BDgraph} | R Documentation |
Simulating multivariate distributions with different types of underlying graph structures, including
"random", "cluster", "smallworld", "scale-free", "lattice", "hub", "star", "circle", "AR(1)", and "AR(2)".
Based on the underlying graph structure, the function generates different types of multivariate data, including "Gaussian", "non-Gaussian", "categorical", "pois" (Poisson), "nbinom" (negative binomial), "dweibull" (discrete Weibull), "binary", or "mixed" data.
This function can be used also for simulating only graphs by setting the option n=0 (default).
bdgraph.sim( p = 10, graph = "random", n = 0, type = "Gaussian", prob = 0.2,
size = NULL, mean = 0, class = NULL, cut = 4, b = 3,
D = diag( p ), K = NULL, sigma = NULL,
q = exp(-1), beta = 1, vis = FALSE, rewire = 0.05,
range.mu = c( 3, 5 ), range.dispersion = c( 0.01, 0.1 ) )
p |
number of variables (nodes). |
graph |
graph structure with options
" |
n |
number of samples required. Note that for the case |
type |
type of data with options " |
prob |
if |
size |
number of links in the true graph (graph size). |
mean |
vector specifying the mean of the variables. |
class |
if |
cut |
if |
b |
degree of freedom for G-Wishart distribution, W_G(b, D). |
D |
positive definite (p \times p) "scale" matrix for G-Wishart distribution, W_G(b, D). The default is an identity matrix. |
K |
if |
sigma |
if |
q, beta |
if p( x, q, β ) = q^{x^{β}}-q^{(x+1)^{β}}, \quad \forall x = \{ 0, 1, 2, … \}. They can be given either as a vector of length p or as an (n x p) matrix, e.g. if covariates are available and a regression model is used. |
vis |
visualize the true graph structure. |
rewire |
rewiring probability for smallworld network. Must be between 0 and 1. |
range.mu, range.dispersion |
if |
An object with S3 class "sim" is returned:
data |
generated data as an (n x p) matrix. |
sigma |
covariance matrix of the generated data. |
K |
precision matrix of the generated data. |
G |
adjacency matrix corresponding to the true graph structure. |
Reza Mohammadi a.mohammadi@uva.nl, Pariya Behrouzi, Veronica Vinciotti, Ernst Wit, and Alexander Christensen
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
Mohammadi, A. and Wit, E. C. (2015). Bayesian Structure Learning in Sparse Gaussian Graphical Models, Bayesian Analysis, 10(1):109-138, doi: 10.1214/14-BA889
Mohammadi, R., Massam, H. and Letac, G. (2021). Accelerating Bayesian Structure Learning in Sparse Gaussian Graphical Models, Journal of the American Statistical Association, doi: 10.1080/01621459.2021.1996377
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):629-645, doi: 10.1111/rssc.12171
Dobra, A. and Mohammadi, R. (2018). Loglinear Model Selection and Human Mobility, Annals of Applied Statistics, 12(2):815-845, doi: 10.1214/18-AOAS1164
Pensar, J. et al (2017) Marginal pseudo-likelihood learning of discrete Markov network structures, Bayesian Analysis, 12(4):1195-215, doi: 10.1214/16-BA1032
graph.sim, bdgraph, bdgraph.mpl
## Not run:
# Generating multivariate normal data from a 'random' graph
data.sim <- bdgraph.sim( p = 10, n = 50, prob = 0.3, vis = TRUE )
print( data.sim )
# Generating multivariate normal data from a 'hub' graph
data.sim <- bdgraph.sim( p = 6, n = 3, graph = "hub", vis = FALSE )
round( data.sim $ data, 2 )
# Generating mixed data from a 'hub' graph
data.sim <- bdgraph.sim( p = 8, n = 10, graph = "hub", type = "mixed" )
round( data.sim $ data, 2 )
# Generating only a 'scale-free' graph (with no data)
graph.sim <- bdgraph.sim( p = 8, graph = "scale-free" )
plot( graph.sim )
graph.sim $ G
## End(Not run)