Causal Inference with DAGs in Pediatric Clinical Research
- Mayta
- May 7
- 3 min read
🎯 Learning Objectives
By the end of this guide, you’ll be able to:
✅ Classify variables into confounders, mediators, colliders, and effect modifiers ✅ Detect bias paths using DAGs ✅ Use DAGitty to build and test your DAG ✅ Apply causal logic to real-world clinical studies
🩺 Clinical Question (New Example)
Does initiating antipyretic treatment within 30 minutes reduce the risk of seizure recurrence in children presenting with febrile seizure?
DEPTh Type: Therapeutic (intervention → outcome)
📌 1. DAG = Directed Acyclic Graph
What’s a DAG?
Directed: Arrows show assumed causality
Acyclic: No loops allowed—no feedback
Graph: A visual model of assumed causal structure
🧠 DAGs map your thinking, not just your variables.
🧠 2. Classifying Variable Roles
Role | Meaning | Adjust? | Example |
Exposure (X) | The treatment or risk factor | — | Antipyretic within 30 minutes |
Outcome (Y) | The endpoint | — | Seizure recurrence within 6 hours |
Confounder | Common cause of X and Y | ✅ | Initial fever severity |
Mediator | Lies on causal path X → Y | ❌* | Rate of temperature decline |
Collider | Caused by both X and Y | ❌ | ED length of stay |
Effect Modifier | Alters strength of X → Y | ➕ | Underlying epilepsy |
Precursor | Precedes X or Y, not necessarily a cause | ⚠️ Care | Prior hospitalization |
*Adjust for mediator only if estimating direct effect.
🧪 3. Drawing the DAG
dagitty
dag {
FeverSeverity -> EarlyAntipyretic
FeverSeverity -> SeizureRecurrence
EarlyAntipyretic -> TempDecline
TempDecline -> SeizureRecurrence
Epilepsy -> SeizureRecurrence
Epilepsy -> EarlyAntipyretic
ED_Crowding -> EarlyAntipyretic
}
✅ Adjust for: FeverSeverity, Epilepsy
❌ Don’t adjust for: TempDecline (mediator), ED_Crowding (precursor), LengthOfStay (collider)
🔗 Try it: Open DAG in DAGitty
🔁 4. Understanding Path Types
Path Type | Example | Open? | Adjust? | Why? |
Causal | X → Y | ✅ | ❌ | This is the path you want to estimate |
Backdoor (confounder) | X ← C → Y | ✅ | ✅ | Biases effect estimate |
Mediated causal path | X → M → Y | ✅ | ❌* | Keep open if estimating total effect |
Collider path | X → Z ← Y | ❌ | ❌ | Adjusting opens a spurious path |
🧠 Collider adjustment = new bias creation, not removal.
🧱 5. Backdoor Control
🎯 Backdoor paths = non-causal routes that simulate effects.
To close them:
Identify confounders on these paths
Adjust using regression, matching, and stratification
Validate with DAGitty’s “Adjustment Sets”
In our case:
EarlyAntipyretic ← FeverSeverity → SeizureRecurrence
EarlyAntipyretic ← Epilepsy → SeizureRecurrence ✅ Adjusting for FeverSeverity and Epilepsy blocks both paths.
💥 6. Collider Trap in Pediatric Context
New Scenario:
Let’s add:
dagitty
LengthOfStay -> EarlyAntipyretic
LengthOfStay -> SeizureRecurrence But wait — that's wrong. LengthOfStay is affected by both:
dagitty
dag {
EarlyAntipyretic -> LengthOfStay
SeizureRecurrence -> LengthOfStay
}
Here, LengthOfStay is a collider. ❌ Adjusting for it opens a backdoor: EarlyAntipyretic → LOS ← SeizureRecurrence
🎭 7. Effect Modification vs. Interaction
Concept | What It Means | Example |
Effect Modifier | X → Y effect varies by Z | Antipyretic works better in children without epilepsy |
Interaction | X1 and X2 together influence Y differently | High fever + fast antipyretic = exponential benefit |
Model it with: X + Z + X*Z Visualize it by: Stratified DAGs or subgroup KM curves
🧩 8. Clinical Reasoning First: Then Model
Use this workflow:
Clinical Question → Variable Roles → DAG → DAGitty Adjustment → Regression Model
❌ Don’t start with a dataset ✅ Start with causal structure
📋 9. DAG Construction Checklist
Define exposure (X) and outcome (Y)
Identify variable roles:
Confounders
Mediators
Colliders
Precursors
Draw DAG (DAGitty or pen + paper)
Run Adjustment Sets in DAGitty
Build a regression model with justified covariates
✅ Final Takeaways
DAGs ≠ illustrations — they are logic blueprints for your research.
Adjust only confounders; avoid colliders unless modeling effect mediation.
DAGitty helps verify if your adjustment set is both valid and minimal.
Model causal paths, not just correlations.
DEPTh logic ensures alignment with clinical decision-making.
Comments