Test whether sets of variables are d-connected in a DAG given a conditioning set. This is the complement of d-separation.
Value
A tibble with columns:
from_set
: String representation of source nodesfrom
: List column of source nodesto_set
: String representation of target nodesto
: List column of target nodesconditioning_set
: String representation of conditioning variablesconditioned_on
: List column of conditioning variablesdconnected
: Logical indicating d-connection
Examples
library(ggdag)
dag <- dagify(
y ~ x + z,
x ~ w,
z ~ w
)
query_dconnected(dag, from = "x", to = "z")
#> # A tibble: 1 × 7
#> from_set from to_set to conditioning_set conditioned_on dconnected
#> <chr> <list> <chr> <list> <chr> <list> <lgl>
#> 1 {x} <chr [1]> {z} <chr [1]> {} <chr [0]> TRUE
query_dconnected(dag, from = "x", to = "z", conditioned_on = "w")
#> # A tibble: 1 × 7
#> from_set from to_set to conditioning_set conditioned_on dconnected
#> <chr> <list> <chr> <list> <chr> <list> <lgl>
#> 1 {x} <chr [1]> {z} <chr [1]> {w} <chr [1]> FALSE