cpdag <- cgraph(A %---% B %---% C, class = "CPDAG")
apply_background_knowledge(cpdag, A %-->% B)
#> MPDAG with 3 nodes and 2 edges:
#> nodes: A, B, C
#> edges:
#> A --> B, B --> C
apply_background_knowledge(cpdag, C %!-->% B)
#> MPDAG with 3 nodes and 2 edges:
#> nodes: A, B, C
#> edges:
#> A --- B, B --> C

Apply background knowledge to a PDAG
Source: R/transform.R
Description
Orients cg according to background knowledge about direct causes: required edges (A %-->% B, A must directly cause B) and forbidden ones (A %!-->% B, A must not).
Usage
apply_background_knowledge(cg, ..., spec = NULL)Arguments
cg
|
A PDAG-family graph (PDAG, CPDAG, MPDAG) 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 ....
|
Details
Requiring A --> B orients A --- B that way, and forbidding it orients A --- B as B --> A; after each, Meek’s rules propagate the orientations it implies. Background knowledge only orients edges, so it errors when it would add or remove one: a required edge between non-adjacent nodes or against an orientation cg (or an earlier item) already has, or a forbidden edge cg already has.
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.