# NOT RUN {
dag <- dagify(m ~ x + y)
dag %>% ggdag_drelationship("x", "y")
dag %>% ggdag_drelationship("x", "y", controlling_for = "m")
dag %>%
node_dseparated("x", "y") %>%
ggplot(aes(x = x, y = y, xend = xend, yend = yend, shape = adjusted, col = d_relationship)) +
geom_dag_edges() +
geom_dag_collider_edges() +
geom_dag_node() +
geom_dag_text(col = "white") +
theme_dag() + scale_dag()
dag %>%
node_dconnected("x", "y", controlling_for = "m") %>%
ggplot(aes(x = x, y = y, xend = xend, yend = yend, shape = adjusted, col = d_relationship)) +
geom_dag_edges() +
geom_dag_collider_edges() +
geom_dag_node() +
geom_dag_text(col = "white") +
theme_dag() +
scale_dag()
dagify(m ~ x + y, m_jr ~ m) %>%
tidy_dagitty(layout = "nicely") %>%
node_dconnected("x", "y", controlling_for = "m_jr") %>%
ggplot(aes(x = x, y = y, xend = xend, yend = yend, shape = adjusted, col = d_relationship)) +
geom_dag_edges() +
geom_dag_collider_edges() +
geom_dag_node() +
geom_dag_text(col = "white") +
theme_dag() +
scale_dag()
# }
Run the code above in your browser using DataLab