Stratifying on colliders can open biasing pathways between variables. activate_collider_paths activates any such pathways given a variable or set of variables to adjust for and adds them to the tidy_dagitty.

activate_collider_paths(.tdy_dag, adjust_for, ...)

Arguments

.tdy_dag

input graph, an object of class tidy_dagitty or dagitty

adjust_for

a character vector, the variable(s) to adjust for.

...

additional arguments passed to tidy_dagitty()

Value

a tidy_dagitty with additional rows for collider-activated pathways

See also

Examples

dag <- dagify(m ~ x + y, x ~ y) collided_dag <- activate_collider_paths(dag, adjust_for = "m") collided_dag
#> # A DAG with 3 nodes and 3 edges #> # #> # Paths opened by conditioning on a collider: x <-> y #> # #> # A tibble: 5 x 9 #> name x y direction to xend yend circular collider_line #> <chr> <dbl> <dbl> <fct> <chr> <dbl> <dbl> <lgl> <lgl> #> 1 x 2.68 2.44 -> m 2.49 1.46 FALSE FALSE #> 2 y 1.74 2.11 -> m 2.49 1.46 FALSE FALSE #> 3 y 1.74 2.11 -> x 2.68 2.44 FALSE FALSE #> 4 m 2.49 1.46 <NA> <NA> NA NA FALSE FALSE #> 5 x 2.68 2.44 <-> y 1.74 2.11 NA TRUE