Simulate a directed acyclic graph with mixed data (gaussian and binary).
DAGsim(n, p, sparsity = 0.02, p.binary, type="AR(2)", verbose = TRUE)
Number of observations.
Number of variables. Not applicable to the graph of "alarm"
type.
Sparsity of the graph in the "random"
type, the default value is 0.02. Not applicable to other types.
Number of binary variables. Not applicable to the graph of "alarm"
type. The default value is p/2
.
The graph structure with 3 options: "random"
, "alarm"
and "AR(2)"
(default).
If verbose = FALSE
, tracing information printing is disabled. The default value is TRUE
.
A list of five objects.
A \(p\)x\(p\) 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\).
The simulated dataset in a \(n\)x\(p\) matrix.
The simulated adjacency matrix of the moral graph, which is the undircted version of Bayesian network.
The index of Gaussian variables.
The index of binary variables.
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.
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.
# NOT RUN {
library(equSA)
DAGsim(n=300, p=100, type="AR(2)", p.binary=50)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab