Interventions (do(·))

Graph surgery and intervention plots live in DAGMakie. do_surgery is display-only (mutilate a DAG for figures); it is not an identification API. For whether an effect is identifiable, and for CDM do(·) semantics, use CausalInference.jl / CausalDynamics.jl (DoIntervention, apply_intervention, …).

using Graphs, DAGMakie, CairoMakie

g, labels = confounding_graph(["Z", "X", "Y"])

# do(X): remove incoming edges to X
g_do = do_surgery(g, 2)
@assert !has_edge(g_do, 1, 2)
@assert has_edge(g_do, 2, 3)

fig, ax, p = dagplot_intervention(g, Intervention(2); nlabels = labels)
fig
Example block output

Compare factual and intervened graphs:

using Graphs, DAGMakie, CairoMakie

g, labels = confounding_graph(["Z", "X", "Y"])
fig = dagplot_do_comparison(g, 2; nlabels = labels)
fig
Example block output