bdgraph.sim | 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", "t" (t-distribution), "alternative-t", 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 ), nu = 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, |
D |
positive definite |
K |
if |
sigma |
if |
q , beta |
if
They can be given either as a vector of length p or as an ( |
vis |
visualize the true graph structure. |
rewire |
rewiring probability for smallworld network. Must be between 0 and 1. |
range.mu , range.dispersion |
if |
nu |
if |
An object with S3
class "sim
" is returned:
data |
generated data as an ( |
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, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v089.i03")}
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.