
Diagnose adjustment-set and role robustness to uncertain edge directions
Source:R/pdag.R
pdag_robustness.RdGiven a DAG plus one or more edges whose direction is uncertain (a PDAG), enumerate every acyclic orientation and report whether the minimal/canonical adjustment sets or covariate roles change – i.e., whether your estimand is robust to that structural uncertainty.
Usage
pdag_robustness(
dag,
exposure,
outcome,
uncertain_edges = NULL,
pdag = NULL,
formula = NULL,
max_uncertain = 10L
)Arguments
- dag
A
dagittyDAG (the "root" model).- exposure, outcome
Optional; inferred from the DAG when omitted.
- uncertain_edges
Character vector like
c("A -- B")naming edges whose direction is unknown.- pdag
Optional
dagittyPDAG; its--edges are treated as uncertain.- formula
Optional model formula; used to decide whether an ambiguous covariate is actually in your specification (affects re-estimation advice).
- max_uncertain
Integer guard on the number of uncertain edges (default 10 -> up to 1024 worlds).
Examples
# What if we're unsure which way two arrows point?
pdag_robustness(toy_dag, uncertain_edges = c("Z -- X", "M -- Y"))
#>
#> PDAG robustness summary:
#> - uncertain edges specified: 2
#> - worlds evaluated (acyclic orientations): 4
#> - minimal adjustment set changed: yes
#> - canonical adjustment set changed: yes
#> - covariate role changed: mediator -> ambiguous (collider / mediator) for M
#> - covariate role changed: confounder -> ambiguous (confounder / mediator) for Z (good/bad control flip)
#> - re-estimation recommended: yes