dag <- cgraph(A %-->% B, B %-->% C)
dag_to_mpdag(dag)
#> MPDAG with 3 nodes and 2 edges:
#> nodes: A, B, C
#> edges:
#> A --- B, B --- C
dag_to_mpdag(dag, A %-->% B)
#> MPDAG with 3 nodes and 2 edges:
#> nodes: A, B, C
#> edges:
#> A --> B, B --> C

Convert a DAG to its MPDAG
Source: R/transform.R
Description
Returns the MPDAG representing the DAGs Markov equivalent to cg and consistent with any background knowledge: the CPDAG of cg with that knowledge applied, closed under meek_closure()’s rules R1-R4. Errors if cg itself violates the knowledge, i.e. it lacks a required edge or has a forbidden one.
Usage
dag_to_mpdag(cg, ..., spec = NULL)Arguments
cg
|
A DAG created with cgraph().
|
...
|
Required (%-->%, %<--%) and forbidden (%!-->%, %!<--%) edges; see edge-operators. Mutually exclusive with spec.
|
spec
|
Background knowledge as a string, e.g. "A --> B, C !--> D", for programmatic use. Mutually exclusive with ....
|
Value
A cgraph of class MPDAG.
References
Meek C (1995). “Causal inference and causal explanation with background knowledge.” In Proceedings of UAI 1995, 403–410.