Counterfactual reasoning asks a question that standard data analysis cannot answer: what would have happened if things had been different? Not “what pattern exists in the data” (Rung 1), not “what would happen if we intervene going forward” (Rung 2), but “given what actually occurred, what would the outcome have been under a different scenario?” This is Rung 3 of Pearl’s causal ladder — the most powerful, and the most demanding, form of causal inference.Documentation Index
Fetch the complete documentation index at: https://wuweism.com/llms.txt
Use this file to discover all available pages before exploring further.
What a counterfactual question looks like
Counterfactual questions are recognizable by their hypothetical structure. They refer to specific realized events and ask about unrealized alternatives:- “Would this patient have recovered if they had received the treatment earlier?”
- “Would the defendant’s injury have occurred but for the manufacturer’s negligence?”
- “Would the neural circuit have activated if the inhibitory signal had been absent?”
Do-calculus interventions — the do(·) operator
The formal tool for counterfactual and interventional reasoning is Pearl’s do-calculus. The notation do(X = v) means: set variable X to the value v, regardless of what would naturally have caused X to take that value.
This is different from conditioning. Conditioning on X = v means “look at observations where X happened to equal v.” The do(·) operator cuts X free from its natural causes in the causal graph and forces it to a specific value — simulating a perfect experimental intervention.
The Identifiability Gate
Before Wu-Weism computes a counterfactual or intervention, it runs an Identifiability Gate — a check that determines whether the causal effect can be validly estimated from the available information. An effect is identifiable if every backdoor path from the treatment variable to the outcome variable can be blocked by adjusting for observable variables in the causal graph. If unobserved confounders exist and cannot be controlled for, the effect is not identifiable, and a spurious estimate would be misleading. The identifiability check requires:- The treatment variable — the variable you are intervening on
- The outcome variable — the variable you are measuring
- The adjustment set — the variables to condition on to block backdoor paths
- The known confounders — variables that causally influence both treatment and outcome
identifiable is false, the missingConfounders field lists the variables that would need to be observed to make the effect estimable. The note explains the specific identifiability failure in plain language.
What happens when an intervention is blocked
If the Identifiability Gate determines that a causal effect cannot be identified, Wu-Weism does not generate a Rung 2 or Rung 3 answer. Instead:- The response is downgraded to Rung 1 — an association-level answer based on the available observational data.
- The response includes a clear explanation of why the intervention could not be computed, naming the missing confounders.
- The Claim Ledger records the downgrade decision as part of the claim’s provenance.
Counterfactual traces
Every intervention that passes the Identifiability Gate produces a counterfactual trace — a deterministic, persistent record of the computation. Traces exist so that analyses can be audited, reproduced, and challenged. A counterfactual trace contains:| Field | Description |
|---|---|
estimand | The formal causal estimand — what quantity was computed |
actualOutcome | The observed outcome in the actual world |
counterfactualOutcome | The estimated outcome under the hypothetical intervention |
difference | The estimated causal effect: counterfactualOutcome − actualOutcome |
explanation | A plain-language account of how the counterfactual was computed |
| Trace metadata field | Description |
|---|---|
modelKey | The SCM used for the computation |
version | The version of the SCM |
intervention.variable | The variable that was intervened on |
intervention.value | The value it was set to |
method | The computation method — always deterministic_graph_diff |
traceId | The unique identifier for this trace |
assumptions | The modelling assumptions under which the result holds |
adjustmentSet | The variables conditioned on to identify the effect |
deterministic_graph_diff method works by: (1) abducing the exogenous noise variables consistent with the observed outcome, (2) modifying the intervened variable in the causal graph, (3) propagating the change forward through the graph to produce the counterfactual outcome. The difference between the two outcomes is the estimated causal effect.
Viewing counterfactual traces
Traces are accessible via the API using the trace ID, which is displayed in the workbench alongside any Rung 3 response.claim_kind: "counterfactual", its trace_id field points to the trace that produced it.
How to trigger an intervention in the workbench
Switch to intervene mode
Select the intervene operator from the mode selector in the chat input area. The interface will shift to indicate you are framing an intervention, not an observation query.
Frame your question as an intervention
State what variable you are setting and to what value. Use explicit language: “What would the outcome have been if [variable] had been [value]?”Wu-Weism will parse the intervention target and value from your question. If ambiguous, it will ask for clarification before running the identifiability check.
Review the identifiability check
The workbench shows the result of the Identifiability Gate before generating the answer. If the check fails, you will see which confounders are missing and why the effect cannot be estimated.
Worked example
Suppose you are analyzing the effect of an educational intervention — specifically, whether earlier introduction of a learning strategy caused better outcomes. Your question (intervene mode): “What would the student’s test score have been if the intervention had begun in week 1 rather than week 6?” What Wu-Weism does:- Classifies the domain as
education. - Loads the education SCM from the registry.
- Checks identifiability: Is the causal effect of intervention timing on test scores identifiable, given available confounders (prior attainment, engagement, teacher quality)?
- If identifiable: Computes the counterfactual outcome by setting
intervention_start_week = 1in the causal graph and propagating forward. - Returns the actual score, the counterfactual score, the estimated difference, and the trace ID.
estimand:P(score | do(intervention_start_week = 1))actualOutcome: 72 (observed score with week 6 start)counterfactualOutcome: 81 (estimated score with week 1 start)difference: +9adjustmentSet:["prior_attainment", "engagement_score"]
What are the limits of counterfactual reasoning?
What are the limits of counterfactual reasoning?
Counterfactuals are only as reliable as the SCM they are computed from. If the causal graph is misspecified — if important variables are missing, or if the functional relationships between variables are wrong — the counterfactual outcome will be wrong too.Wu-Weism mitigates this through the Identifiability Gate (which detects missing confounders) and through the
assumptions field in the trace record (which makes the modelling assumptions explicit). But the SCM is always a model of reality, not reality itself.Can I run multiple interventions on the same case?
Can I run multiple interventions on the same case?
Yes. Each intervention creates a separate trace. You can run multiple counterfactuals for the same session, varying the intervention variable, the intervention value, or both. Each trace is independent and carries its own identifiability result.
What is the difference between a Rung 2 and Rung 3 answer?
What is the difference between a Rung 2 and Rung 3 answer?
A Rung 2 answer estimates the population-level causal effect of an intervention: “If we assigned treatment X to everyone, what would the average outcome be?” A Rung 3 answer addresses a specific realized case: “Given that this individual had outcome Y, what would their outcome have been if they had received treatment X instead?”Rung 3 requires knowing the exogenous factors specific to the individual case — which is why it is both more powerful and more demanding than Rung 2.
Related concepts
Pearl's causal ladder
Where counterfactuals sit in the three-rung hierarchy.
Structural Causal Models
The models that make counterfactual computation possible.
Claim Ledger
How counterfactual claims are recorded and audited.
