0

How can I use ggdag to plot backdoor paths only?

For instance, given the following code:

library(ggdag)

tidy_ggdag <- dagify(
    y ~ t + x1,
    t ~ x1,
    exposure = "t",
    outcome = "y"
) %>% tidy_dagitty()

ggdag_paths(tidy_ggdag) + theme_dag()

It plots all open paths, not only backdoor ones:

enter image description here

robertspierre
  • 3,218
  • 2
  • 31
  • 46

0 Answers0