Learn R Programming

BDgraph (version 2.7)

bdgraph.sim: Data generator according to graph structure

Description

Implements the data generation from multivariate normal distributions with different graph structures, including "random", "cluster", "fixed", and "circle". The default is "random".

Usage

bdgraph.sim(n = 2, p = NULL, graph = NULL, size = NULL, prob = NULL, class = NULL, 
            v = NULL, u = NULL, G = NULL, 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", "cluster", "fixed", and "circle". The default is "random".
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.
v
the off-diagonal elements of the precision matrix, controlling the magnitude of partial correlations with u. The default value is 0.3.
u
a positive number being added to the diagonal elements of the precision matrix, to control the magnitude of partial correlations. The default value is 0.1.
G
adjacency matrix which shows the graph structure. It is an upper triangular matrix in which $g_{ij}=1$ if there is a link between notes $i$ and $j$, otherwise $g_{ij}=0$.
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:
  • datathe $n \times p$ matrix for the generated data
  • sigmathe covariance matrix of the generated data
  • Kthe precision matrix of the generated data
  • Gthe adjacency matrix of true graph structure

References

Mohammadi, A. and E. C. Wit (2012). Gaussian graphical model determination based on birth-death MCMC inference, arXiv:1210.5371v4. http://arxiv.org/abs/1210.5371v4

See Also

bdgraph

Examples

Run this code
# generating the data from a random graph
  data.sim <- bdgraph.sim(n = 100, p = 8, size = 10, vis = TRUE)
  print(data.sim)
  
  data.sim <- bdgraph.sim(n = 1, p = 6, graph = "circle", vis = TRUE)
  data.sim $ data

Run the code above in your browser using DataLab