dag2essgraph | R Documentation |
Convert a DAG to an (interventional or observational) essential graph.
dag2essgraph(dag, targets = list(integer(0)))
dag |
The DAG whose essential graph has to be calculated. Different
representations are possible: |
targets |
List of intervention targets with respect to which the
essential graph has to be calculated. An observational setting is
represented by one single empty target ( |
This function converts a DAG to its corresponding (interventional or observational) essential graph, using the algorithm of Hauser and Bühlmann (2012).
The essential graph is a partially directed graph that represents the (interventional or observational) Markov equivalence class of a DAG. It has the same has the same skeleton as the DAG; a directed edge represents an arrow that has a common orientation in all representatives of the (interventional or observational) Markov equivalence class, whereas an undirected edge represents an arrow that has different orientations in different representatives of the equivalence class. In the observational case, the essential graph is also known as “CPDAG” (Spirtes et al., 2000).
In a purely observational setting (i.e., if targets =
list(integer(0))
), the function yields the same graph as
dag2cpdag
.
Depending on the class of dag
, the essential graph is returned as
an instance of graphNEL
, if dag
is an
instance of graphNEL
,
an instance of EssGraph
, if dag
is
an instance of a class derived from ParDAG
.
Alain Hauser (alain.hauser@bfh.ch)
A. Hauser and P. Bühlmann (2012). Characterization and greedy learning of interventional Markov equivalence classes of directed acyclic graphs. Journal of Machine Learning Research 13, 2409–2464.
P. Spirtes, C.N. Glymour, and R. Scheines (2000). Causation, Prediction, and Search, MIT Press, Cambridge (MA).
dag2cpdag
, Score
, EssGraph
p <- 10 # Number of random variables
s <- 0.4 # Sparseness of the DAG
## Generate a random DAG
set.seed(42)
require(graph)
dag <- randomDAG(p, s)
nodes(dag) <- sprintf("V%d", 1:p)
## Calculate observational essential graph
res.obs <- dag2essgraph(dag)
## Different argument classes
res2 <- dag2essgraph(as(dag, "GaussParDAG"))
str(res2)
## Calculate interventional essential graph for intervention targets
## {1} and {3}
res.int <- dag2essgraph(dag, as.list(c(1, 3)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.