DAGs and Assumptions in Causal Inference
dags-and-assumptions.Rmdπ DAGs and Assumptions in Causal Inference
Directed Acyclic Graphs (DAGs) provide a powerful way to encode assumptions about how variables in your system are related.
They help us: - Identify confounders and mediators - Test identification strategies - Derive adjustment sets
π― Define a Simple DAG
Letβs say weβre estimating the effect of Treatment on
Outcome, with a confounder X.
dag <- dagitty("dag {
X -> Treatment
X -> Outcome
Treatment -> Outcome
}")
plot(dag)
π Adjustment Sets
Which variables do we need to control for to identify the causal
effect of Treatment on Outcome?
adjustmentSets(dag, exposure = "Treatment", outcome = "Outcome")## { X }
This shows that adjusting for X is sufficient.
π§ More Complex DAG
complex_dag <- dagitty("dag {
Age -> Treatment
Income -> Treatment
Age -> Outcome
Income -> Outcome
Treatment -> Behavior -> Outcome
unobserved1 [unobserved]
unobserved1 -> Income
unobserved1 -> Outcome
}")
ggdag::ggdag(complex_dag, layout = "circle")
ggtitle("DAG with Confounding and Mediation")## $title
## [1] "DAG with Confounding and Mediation"
##
## attr(,"class")
## [1] "labels"