I'm using ggdag to create a DAG such as
test <- dagify("a" ~ "b",
"b" ~ "c",
"c" ~ "d",
"b" ~ "d",
exposure = "b",
outcome = "d",
labels = c(a = "A",
b = "B",
c = "D"))
And with ggplot I can get nice control…
This is my first time using the tool, but I do not understand why I do not manage to plot a graph. My original intention was to run a simple graph with many variables like the next one:
dagify(
Y ~ Z1+X1+Z2+X2+U1+U2,
X1 ~ Z1+U1,
X2 ~ Z2+U2),
…
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) +…