Tests whether two node sets are d-separated given a conditioning set, using the reachability ("Bayes-ball") algorithm (Koller & Friedman, 2009, Algorithm 3.1).
Usage
dsep(g, x, y, z = character(0))Arguments
- g
A
dm_graph(or any list with anedgesmatrix with columnsfrom,to).- x, y
Character vectors of node names (window indices:
"X3"is the state at the third prompt of the window;recoverabilityuses the third prompt as \(t\)).- z
Character vector of conditioning nodes (may be empty).
Value
A single logical value: TRUE if every node in x is
d-separated from every node in y given z, FALSE
otherwise.
References
Koller, D., & Friedman, N. (2009). Probabilistic graphical models: Principles and techniques. MIT Press.
Shachter, R. D. (1998). Bayes-ball: The rational pastime (for determining irrelevance and requisite information in belief networks and influence diagrams). In Proceedings of the Fourteenth Conference on Uncertainty in Artificial Intelligence (pp. 480-487). Morgan Kaufmann.
Examples
g <- dm_graph("M1")
dsep(g, "R3", "X3", c("X2", "eta")) # TRUE: the kernel is recoverable
#> [1] TRUE
g2 <- dm_graph("M2")
dsep(g2, "R3", "X3", c("X2", "eta")) # FALSE: self-censoring
#> [1] FALSE
# any edge list works, not only dm-graphs: a collider A -> B <- C
coll <- list(nodes = c("A", "B", "C"),
edges = cbind(from = c("A", "C"), to = c("B", "B")))
dsep(coll, "A", "C") # TRUE
#> [1] TRUE
dsep(coll, "A", "C", "B") # FALSE: conditioning on the collider opens the path
#> [1] FALSE