Suppose a customer received a treatment, but you want to know what their outcome would have been without it. The question combines a factual condition with a hypothetical outcome. A counterfactual graph puts variables from those worlds into one query-specific DAG so their relationships can be examined. section 10.10 section 10.7.2
Start with a parallel world graph and the events in the query. Identify variables that must have the same value across worlds because the intervention does not affect them, then collapse their nodes. Keep the nodes relevant to the query. This matters because an uncollapsed parallel world graph can misleadingly suggest, through d-separation, that two copies of the same unaffected variable are independent. D-separation can instead be used on the counterfactual graph. section 10.7.2 section 9.1.3
An effect on the treated
Consider P(A_{T=−t}=+a | T=+t): among cases that received treatment, ask about the outcome under no treatment. The events A_{T=−t}=+a and T=+t determine the counterfactual graph. Adding further events need not change its structure: the illustrated expanded query, which also includes B=−b and V_{B=−b}=+v, produces the same graph. The graph supports reasoning about identification; constructing it does not itself establish that the query is identifiable. section 10.7.2 section 10.7.5
Listing 10.10 Listing 10.10 Counterfactual graph events AT=–t=+a and T=+t
from y0.algorithm.identify.cg import make_counterfactual_graph
events = {A @ -t: +a, T: +t} #1
cf_graph, _ = make_counterfactual_graph(dag, events)
gv_draw(cf_graph)
The Y0 listing turns the factual and hypothetical events into a counterfactual graph from a causal DAG. section 10.7.2
Counterfactual graphs are used for graphical identification, including queries that can be graphed but not identified from lower-level data. A single-world intervention graph (SWIG) is a different option: it splits a node, retains all original variables, and relies on a single-world assumption. Counterfactual graphs instead collapse equivalent nodes across worlds and retain those relevant to a particular query. section 10.10 section 10.7.5
