Learn R Programming

BDgraph (version 2.13)

bdgraph.sim: Synthetic graph data generator

Description

Implements a synthetic graph data generation with different graph structures, including "random", "cluster", "scale-free", "hub" "fixed", and "circle". The default is "random". Based on the graph structure, it generate four differents data sets which is multivariate Gaussian, non-Gaussian, discrete, or mixed data.

Usage

bdgraph.sim( n = 2, p = 10, graph = "random", size = NULL, prob = 0.2, 
             class = NULL, type = "Gaussian", cut = 4, b = 3, D = diag(p), 
             K = NULL, sigma = NULL, mean = 0, 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.
graph
The graph structure with option "random" (as a default), "cluster", "scale-free", "hub" "fixed", and "circle". It also could be adjacency matrix corresponding to the graph structure (an upper triangular matrix in which $g_{ij}=1$ if there is
size
The number of links in true graph (graph size).
prob
For "random" graph, it is the probability that a pair of nodes has a link. The default value is 0.2.
class
Is number of the classes for "cluster" option.
type
Type of data which has four options "Gaussian" (as a default), "non-Gaussian", "discrete", and "mixed". For option "Gaussian", data is generated from multivariate normal distribution. For option "non-Gaussian", data is transfered multivariate normal
cut
For simulated discrete data (type = "discrete"), it is number of categories for discrete variables. 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
A positive-definite symmetric matrix specifying the precision matrix of the variables. It is for "fixed" option of graph.
sigma
A positive-definite symmetric matrix specifying the covariance matrix of the variables. It is for "fixed" option of graph.
mean
A vector specifying the mean of the variables. The default value is zero.
vis
visualize the true graph pattern. The default value is FALSE.

Value

  • an object with S3 class "simulate" as follow:
  • dataGenerated data which is 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 Wit, E. C. (2014). Bayesian structure learning in sparse Gaussian graphical models, Bayesian Analysis, acceped. http://arxiv.org/abs/1210.5371v6

See Also

bdgraph

Examples

Run this code
# generating synthetic multivariate normal data from a 'random' graph
		data.sim <- bdgraph.sim( n = 50, p = 10, prob = 0.3, vis = TRUE )
		print(data.sim)

		# generating synthetic multivariate normal data from a 'hub' graph
		data.sim <- bdgraph.sim( n = 3, p = 6, graph = "hub", vis = FALSE )
		data.sim $ data

		# generating synthetic mixed data from a 'hub' graph 
		data.sim <- bdgraph.sim( n = 10, p = 8, graph = "hub", type = "mixed" )
		data.sim $ data

Run the code above in your browser using DataLab