Causal DAG
In Academic Harness:
causal_dagstores the graph under.dsh/causal/<slug>/and derives graph properties. It never fits a model or estimates an effect. Estimation belongs inanalysis_runwith explicit code.
Workflow
- State the estimand first. Name the treatment
X, outcomeY, and target population/intervention. A DAG without an estimand cannot answer an identification question. - Draw the assumed graph. Include unmeasured common causes as latent
nodes (
{id: "U", latent: true}); omitting them asserts they are absent.createaccepts nodes/edges or DOT, Mermaid, or edge-list text (textorfile+format). Every later change is a new version with a reason. - Check the graph.
analyzereports the treatment–outcome d-separation, minimal backdoor adjustment sets, front-door sets, collider/M-bias warnings, instrument candidates, and local-Markov testable implications. Passgivento test a specific conditioning set andadjust_forto have a proposed set warned about (descendant of treatment, collider, unobserved). - Defend the set. A minimal set is minimal by inclusion under this graph, not automatically the best estimator choice. Report the assumptions that make it valid, especially no unmeasured treatment–outcome confounding.
- Sensitivity.
evaluescomputes VanderWeele E-values for RR/OR/HR, or an approximate standardized-effect conversion. An E-value is the minimum confounder association needed to explain away the estimate; it is not evidence that confounding is absent. - Estimate elsewhere. Freeze an
analysis_runplan that names the estimand, adjustment set, estimator, positivity diagnostics, and sensitivity analyses. Do not turn graph-implied identification into an estimated effect.
Guardrails
- The graph is the user's assumption; do not add arrows the user did not state.
- Absence of an arrow is a claim of no direct causal effect, not a finding.
- A collider warning is a graph warning, not proof of bias in a fitted model.
- Instruments need more than the graph conditions (effect homogeneity, monotonicity, no unmeasured confounding); state the caveats.
exportwrites Mermaid, DOT, edge list, or JSON. Use the same slug inpreregisterto import treatment/outcome and the latest adjustment set.
References
- Pearl, Causality (2nd ed.) — backdoor/front-door criteria.
- Hernán & Robins, Causal Inference: What If — target trials, adjustment, positivity.
- VanderWeele & Ding (2017), Annals of Internal Medicine — E-values.