> ## Documentation Index
> Fetch the complete documentation index at: https://wuweism.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Running interventions with do-calculus

> How to phrase intervention questions, understand the identifiability gate, and read intervention results in Wu-Weism.

An **intervention** in causal inference is fundamentally different from an observation. When you observe that two variables are correlated, you are on Rung 1 of Pearl's causal ladder. When you ask what would happen if you actively *set* a variable to a specific value — regardless of its natural causes — you are on Rung 2, and you need do-calculus to answer the question correctly.

Wu-Weism operationalizes Rung 2 through an **intervention pipeline** that checks identifiability before computing effects, so you always know whether your result is causally valid or association-level.

## Observations vs. interventions

|                           | Observation (Rung 1)      | Intervention (Rung 2)                       |
| ------------------------- | ------------------------- | ------------------------------------------- |
| **Question form**         | "Is X associated with Y?" | "What happens to Y if we set X to value v?" |
| **Notation**              | P(Y \| X = x)             | P(Y \| do(X = x))                           |
| **Confounders**           | Can distort the estimate  | Must be accounted for via adjustment set    |
| **Identifiability check** | Not required              | Required before computing effect            |
| **Claim rung**            | Rung 1                    | Rung 2                                      |

The distinction matters because confounders can make an observational association point in the wrong direction or overstate the effect size. The `do()` operator severs the incoming arrows to X in the causal graph, asking: if we forcibly set X (ignoring whatever normally determines it), what does Y become?

## Phrasing intervention questions

Wu-Weism detects intervention intent from specific language patterns. Any of the following will trigger Rung 2 processing:

<CodeGroup>
  ```text do() notation theme={null}
  If we do(anti_inflammatory_drug = 1), what happens to IL-6 levels?
  ```

  ```text Explicit intervention language theme={null}
  If we intervene to set TNF-α to zero, how does CRP respond?
  ```

  ```text Set/assign framing theme={null}
  What would happen if we set cortisol to 50% of baseline during the stress window?
  ```

  ```text Treatment framing theme={null}
  What is the effect of administering the treatment on downstream inflammation markers?
  ```

  ```text Confounder/mediator framing theme={null}
  Holding confounders constant, what is the direct effect of IL-6 on fibrosis?
  ```
</CodeGroup>

**Keywords that reliably trigger Rung 2**: `do(`, `intervention`, `intervene`, `if we set`, `treatment`, `confounder`, `mediator`, `identifiability`

<Tip>
  The most unambiguous phrasing is explicit `do()` notation: `do(variable_name = value)`. This removes any ambiguity between "if we observed X at level v" (Rung 1) and "if we set X to level v" (Rung 2).
</Tip>

## Using operator mode

In addition to natural language triggers, you can force Rung 2 mode from **Model Settings** in the workbench sidebar:

<Steps>
  <Step title="Open Model Settings">
    Click the **Model Settings** icon in the left sidebar of the Causal Chat interface.
  </Step>

  <Step title="Find the operator mode selector">
    Under **Inference Mode**, locate the **Operator** dropdown. The default is **Auto** (Wu-Weism selects the rung based on your question).
  </Step>

  <Step title="Select Intervene">
    Set the operator mode to **Intervene**. This pins all subsequent questions in the session to Rung 2, even if your phrasing is observational.
  </Step>
</Steps>

Operator mode is useful when you are systematically exploring a causal graph and want every question treated as an intervention query, without needing to include `do()` notation each time.

## The identifiability gate

Before Wu-Weism computes any intervention effect, it runs an **identifiability check**. Identifiability means: given the causal graph (SCM) and the available data, can the interventional distribution `P(Y | do(X))` be computed from observational data alone?

If the required confounders are not represented in the loaded SCM, the effect is **not identifiable** and the computation cannot be trusted.

### When identifiability passes

The system proceeds to compute the intervention effect using the adjustment set — the minimal set of variables you need to condition on to block all backdoor paths from X to Y.

```text Identifiability: PASSED theme={null}
Identifiability: PASSED
Adjustment set: {age, baseline_inflammation, bmi}
Proceeding with do-calculus computation...
```

### When identifiability fails

If the identifiability gate blocks the computation, Wu-Weism does not silently return a biased estimate. Instead, it:

1. Downgrades the response to association-level (Rung 1)
2. Explains which confounders are missing from the SCM
3. Labels the claim with `association-only` so it is not mistaken for a causal result

```text Identifiability: BLOCKED theme={null}
Intervention request downgraded: required confounders are missing.
Returning association-level answer.

Missing from SCM: {genetic_IL6_variant, prior_infection_history}
To run this intervention, these variables must be present in your 
adjustment set or representable in the loaded SCM.
```

This behavior is intentional. A Rung 1 answer that is clearly labeled as such is more scientifically useful than a Rung 2 answer that is secretly confounded.

## Worked example: drug intervention on inflammation

**Research scenario**: You are studying whether administering an anti-inflammatory drug reduces interleukin-6 (IL-6) levels in patients with chronic inflammatory disease. You want a causal estimate, not just a correlation.

**Step 1 — Ask the intervention question**

```text theme={null}
If we do(anti_inflammatory_drug = 1), what happens to IL-6 levels 
in patients with baseline CRP > 10 mg/L?
```

**Step 2 — System event flow**

```text Event sequence theme={null}
domain_classified       → immunology
scm_loaded              → immunology-inflammation-v3
intervention_gate       → PASSED (adjustment set: {age, baseline_CRP, disease_duration})
intervention_effect     → computed via backdoor adjustment
answer                  → Rung 2 response with delta and affected nodes
```

**Step 3 — Read the intervention result**

```text Example response shape theme={null}
[Rung 2 — Intervention | do(anti_inflammatory_drug = 1)]

Administering anti_inflammatory_drug (set to active) reduces IL-6 levels 
by an estimated 42% (95% CI: 31–53%) in patients with baseline CRP > 10 mg/L.

Adjustment set applied: {age, baseline_CRP, disease_duration}
Identifiability: PASSED

Affected nodes:
  anti_inflammatory_drug → NF-κB_inhibition → IL-6_synthesis
  anti_inflammatory_drug → COX2_suppression → PGE2 → IL-6_amplification

Delta: −42% IL-6 (mean), −0.81 SD
Causal trace persisted: trace_007

Claim recorded: claim_019
Uncertainty: metric-bearing | Confidence: 0.68
```

## Intervention payload structure

Internally, Wu-Weism represents every intervention as a structured payload. Understanding this helps you interpret what the system is computing:

| Field               | Description                                                                         |
| ------------------- | ----------------------------------------------------------------------------------- |
| `node_id`           | The variable being intervened on (e.g., `anti_inflammatory_drug`)                   |
| `value`             | The value it is set to (e.g., `1` for active, `0` for inactive, or a numeric level) |
| `outcome_var`       | The downstream variable you are measuring (e.g., `IL6_level`)                       |
| `adjustment_set`    | The confounders conditioned on to block backdoor paths                              |
| `known_confounders` | All confounders present in the loaded SCM for this domain                           |

You can also supply these fields directly via the [Causal Chat API](/api/overview) if you are building programmatic workflows.

## Viewing the causal trace

Every successful intervention produces a **causal trace** — a record of which graph edges were activated, which adjustment variables were used, and how the effect propagated through the SCM.

You can view the causal trace in two places:

* **In the Claim Ledger** at `/claims`: locate the claim by ID (e.g., `claim_019`), then expand the **Provenance** section. The trace ID (e.g., `trace_007`) links to the full edge-by-edge record.
* **Via the API**: use the `trace_id` from the claim to query `/api/scm/counterfactual-traces/{traceId}` and retrieve the full trace record as JSON for downstream analysis or audit.

## Common mistakes to avoid

**Asking "what if we observed X at level v?" instead of "what if we set X to v?"**
These are different questions. The first is observational (Rung 1). The second is interventional (Rung 2). When in doubt, use explicit `do()` notation.

**Ignoring the identifiability gate result**
If identifiability fails and the response is labeled `association-only`, do not treat the estimate as causal. The downgrade is a signal that the SCM is missing information needed for a valid Rung 2 answer.

**Assuming a large effect size means identifiability passed**
Effect size and identifiability are independent. A large association can exist even when the causal effect is not identifiable from available data.

## Next steps

* Ask counterfactual questions after an intervention: [Concepts — Counterfactuals](/concepts/counterfactuals)
* Attach supporting literature to your intervention questions: [Analyzing research papers with PDF upload](/guides/pdf-upload)
* Review governed intervention claims: [Claim Ledger](/concepts/claim-ledger)
