Learn R Programming

BDgraph (version 2.23)

bdgraph.sim: Synthetic graph data generator

Description

Implements a synthetic graph data generation for multivariate distributions with different types of underlying graph structures, including "random", "cluster", "scale-free", "hub", "fixed", and "circle". Based on the underling graph structure, it generates four different types of datasets, including multivariate Gaussian, non-Gaussian, discrete, or mixed data.

Usage

bdgraph.sim( n = 2, p = 10, type = "Gaussian", graph = "random", prob = 0.2, 
			 size = NULL, mean = 0, class = NULL, cut = 4, b = 3, 
			 D = diag(p), K = NULL, sigma = NULL, vis = FALSE )

Arguments

n
The number of samples required. The default value is 2.
p
The number of variables (nodes). The default value is 10.
type
Type of data with four options "Gaussian" (as a default), "non-Gaussian", "discrete", and "mixed". For option "Gaussian", data are generated from multivariate normal distribution. Fo
graph
The graph structure with option "random" (default), "cluster", "scale-free", "hub", "fixed", and "circle". It also could be an adjacency matrix corresponding to a graph s
prob
If graph="random", it is the probability that a pair of nodes has a link. The default value is 0.2.
size
The number of links in the true graph (graph size).
mean
A vector specifies the mean of the variables. The default value is a zero vector.
class
If graph="cluster", it is the number of classes.
cut
If type="discrete", it is the number of categories for simulating discrete data. The default value is 4.
b
The degree of freedom for G-Wishart distribution, $W_G(b, D)$. The default is 3.
D
The positive definite $(p \times p)$ "scale" matrix for G-Wishart distribution, $W_G(b, D)$. The default is an identity matrix.
K
If graph="fixed", it is a positive-definite symmetric matrix specifies as a true precision matrix.
sigma
If graph="fixed", it is a positive-definite symmetric matrix specifies as a true covariance matrix.
vis
Visualize the true graph structure. The default value is FALSE.

Value

  • An object with S3 class "sim" is returned:
  • dataGenerated data as a ($n \times p$) matrix.
  • sigmaThe covariance matrix of the generated data.
  • KThe precision matrix of the generated data.
  • GThe adjacency matrix corresponding to the true graph structure.

References

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., F. Abegaz Yazew, E. van den Heuvel, and E. Wit (2015). Bayesian Gaussian Copula Graphical Modeling for Dupuytren Disease, arXiv:1501.04849

See Also

bdgraph

Examples

Run this code
# Generating multivariate normal data from a 'random' graph
data.sim <- bdgraph.sim( n = 50, p = 10, prob = 0.3, vis = TRUE )
print( data.sim )
   
# Generating multivariate normal data from a 'hub' graph
data.sim <- bdgraph.sim( n = 3, p = 6, graph = "hub", vis = FALSE )
round( data.sim $ data, 2 )
   
# Generating mixed data from a 'hub' graph 
data.sim <- bdgraph.sim( n = 10, p = 8, graph = "hub", type = "mixed" )
round( data.sim $ data, 2 )

Run the code above in your browser using DataLab