Detecting colliders in DAGs
Examples
dag <- dagify(m ~ x + y, m_jr ~ m)
is_collider(dag, "m")
#> [1] TRUE
is_downstream_collider(dag, "m_jr")
#> [1] TRUE
# a downstream collider is also treated as a collider
is_collider(dag, "m_jr")
#> [1] TRUE
# but a direct collider is not treated as a downstream collider
is_downstream_collider(dag, "m")
#> [1] FALSE