DAGs, Confounding, and Conditioning

Bayesian
DAGs
Rethinking
Notes on Week 5 of Statistical Rethinking (2023 edition): why adding post-treatment variables skews causal estimates.
Published

August 21, 2026

Code
library(dagitty)

dag <- dagitty('dag {
  Treatment -> Outcome
  Confounder -> Treatment
  Confounder -> Outcome
  Treatment -> PostTreatment -> Outcome
}')

plot(dag)
Plot coordinates for graph not supplied! Generating coordinates, see ?coordinates for how to set your own.