DAGsim: Simulate a directed acyclic graph with mixed data (gaussian...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/DAGsim.R

Description

Simulate a directed acyclic graph with mixed data (gaussian and binary).

Usage

1
DAGsim(n, p, sparsity = 0.02,  p.binary, type="AR(2)", verbose = TRUE)

Arguments

n

Number of observations.

p

Number of variables. Not applicable to the graph of "alarm" type.

sparsity

Sparsity of the graph in the "random" type, the default value is 0.02. Not applicable to other types.

p.binary

Number of binary variables. Not applicable to the graph of "alarm" type. The default value is p/2.

type

The graph structure with 3 options: "random", "alarm" and "AR(2)" (default).

verbose

If verbose = FALSE, tracing information printing is disabled. The default value is TRUE.

Details

Given the type of graph, the patterns are generated as below:

(I) "random": Each pair of off-diagonal elements are randomly set edgematrix[i,j]=1 for i < j with probability sparsity, and 0 otherwise. It results in about p*(p-1)*sparsity/2 edges in the graph.

(II)"AR(2)": The off-diagonal elements are set to be theta[i,j]=1 if i<j and |i-j|<=2 and 0 otherwise.

(III) "alarm": The graph structure is directly borrowed from package 'bnlearn', which has 37 variables with 46 edges. See 'bnlearn' for more detail.

Value

A list of five objects.

edgematrix

A pxp matrix which indicates the true structure of directed acyclic graph. If the (i,j)th element is equal to 1, there exists a directed edge from X_i to X_j.

data

The simulated dataset in a nxp matrix.

moral.matrix

The simulated adjacency matrix of the moral graph, which is the undircted version of Bayesian network.

gaussian.index

The index of Gaussian variables.

binary.index

The index of binary variables.

Author(s)

Suwa Xu, Bochao Jia and Faming Liang

References

Kalisch, M., and Buhlmann, P. (2007). Estimating high-dimensional directed acyclic graphs with the PC-algorithm. Journal of Machine Learning Research, 8(Mar), 613-636.

Xu, S., Jia, B., and Liang, F. (2018). Learning Moral Graphs in Construction of High-Dimensional Bayesian Networks for Mixed Data. Submitted.

I. A. Beinlich, H. J. Suermondt, R. M. Chavez, and G. F. Cooper. The ALARM Monitoring System: A Case Study with Two Probabilistic Inference Techniques for Belief Networks. In Proceedings of the 2nd European Conference on Artificial Intelligence in Medicine, pages 247-256. Springer-Verlag, 1989.

Examples

1
2
library(equSA)
DAGsim(n=300, p=100, type="AR(2)", p.binary=50)

equSA documentation built on May 6, 2019, 1:06 a.m.