Estimate randomized causal mediation
Decompose a randomized intervention into natural direct and mediated effects with optional treatment-mediator interaction, bootstrap intervals, and total-effect reconciliation.
What it's for
Explains which measured pathway carried an intervention effect while preserving a strong warning about mediator-outcome confounding.
What you give it
Inputs split into evidence read from your connected systems, calibration your team owns, and numerical controls that affect precision but never the result's meaning.
| Field | Type | Role | Required |
|---|---|---|---|
| bootstrap_draws | integer ≥ 200, ≤ 20000 | Numerical control | Optional |
| confidence_level | number ≥ 0.8, ≤ 0.999 | Your calibration | Optional |
| feature_names | array of string | Evidence | Optional |
| include_treatment_mediator_interaction | boolean | Your calibration | Optional |
| observations | array of objects (5 fields) | Evidence | Yes |
| ridge | number ≥ 0, ≤ 100 | Your calibration | Optional |
| seed | integer | Numerical control | Optional |
Each observations
record
| Field | Type | Required |
|---|---|---|
| features | object | Optional |
| id | string (non-empty) | Yes |
| mediator | number | Yes |
| outcome | number | Yes |
| treatment | one of "0", "1" | Yes |
{
"bootstrap_draws": 200,
"include_treatment_mediator_interaction": false,
"observations": [
{
"id": "observation-0",
"mediator": 1,
"outcome": 4,
"treatment": 0
},
{
"id": "observation-1",
"mediator": 3.01,
"outcome": 15.049999999999999,
"treatment": 1
},
{
"id": "observation-2",
"mediator": 1.02,
"outcome": 4.1,
"treatment": 0
},
{
"id": "observation-3",
"mediator": 3.03,
"outcome": 15.149999999999999,
"treatment": 1
},
{
"id": "observation-4",
"mediator": 1.04,
"outcome": 4.2,
"treatment": 0
},
{
"id": "observation-5",
"mediator": 3,
"outcome": 15.05,
"treatment": 1
},
{
"id": "observation-6",
"mediator": 1.01,
"outcome": 4.1, Truncated for display — the full payload is 487 lines.
What you get back
This is the actual output of running the example above — computed by the same function the platform calls, not an illustration.
{
"assumptions": [
"Treatment is randomized and the supplied features are measured before assignment.",
"Conditional on treatment and supplied pre-treatment features, there is no unmeasured mediator-outcome confounding.",
"The mediator and outcome models are linear with the declared treatment-mediator interaction and no post-treatment confounder of mediator and outcome.",
"Pathway estimates describe the intervention mechanism at the analyzed cohort level, not individual intent or responsibility."
],
"decision": "mediation_decomposition_estimable",
"effects": {
"decomposed_total_effect": {
"estimate": 10.999,
"interval": {
"high": 11.0231,
"low": 10.979
}
},
"mediator_shift": {
"estimate": 1.9999,
"interval": {
"high": 2.0053,
"low": 1.9948
}
},
"natural_direct_effect": {
"estimate": 2.8185,
"interval": {
"high": 3.2312,
"low": 2.3311
}
},
"natural_indirect_effect": {
"estimate": 8.1804,
"interval": {
"high": 8.6666,
"low": 7.7802
}
},
"total_effect_regression": {
"estimate": 10.999,
"interval": {
"high": 11.0231,
"low": 10.979
}
}, Truncated for display — the full payload is 62 lines.
How it works
Causal inference & experiment design — Separate what a change caused from what merely moved alongside it.
- 1 Decompose a randomized intervention into natural direct and mediated effects with optional treatment-mediator interaction, bootstrap intervals, and total-effect reconciliation.
- 2 Evaluate the method-specific diagnostics and gates returned by the function, then abstain unless the declared decision clears them under locally governed thresholds.
Before you trust it
Every tool in the catalog ships with the conditions under which its answer is meaningful — and the conditions under which it should abstain instead of guessing.
Assumptions & guardrails
- Assignment or adoption timing, interference policy, overlap, attrition, and outcome availability match the estimand encoded by the method.
- A causal label is warranted only when design and diagnostic requirements pass; otherwise treat the result as descriptive or abstain.
Minimum evidence
- observations: required and organization-defined
How to validate it
Preserve the assignment/adoption design and validate overlap, pre-period or placebo diagnostics, attrition, interference policy, and cluster-level uncertainty; never tune on the estimated effect.
Calibrating it to your org
Same for everyone
The mathematical kernel, validation rules, method version, and JSON output semantics are organization-independent; no tenant-trained coefficients or company benchmark is embedded in the function.
Specific to you
- metric/outcome definitions, entity grain, observation window, costs, thresholds, priors, and constraints represented by the function inputs
Calibration workflow
- 1 Define the management decision, target outcome, aggregate unit, privacy boundary, cadence, and prediction/intervention horizon for this organization.
- 2 Build a tenant-scoped historical cohort using only information available before each prediction or decision; preserve zero periods, censoring, assignment probabilities, and unresolved outcomes when the method requires them.
- 3 Estimate statistical parameters on training history, but obtain costs, utilities, risk tolerance, practical-effect thresholds, capacity, and policy constraints from accountable decision owners.
- 4 Validate on later time windows or held-out aggregate units at the deployment grain, against a simple baseline and the function-specific validation strategy.
- 5 Deploy only if the returned decision clears evidence, overlap, calibration, robustness, and guardrail checks; warning, unsupported, schema-gap, and fallback decisions are abstentions.
- 6 Monitor realized outcomes, data drift, coverage, and decision regret; recalibrate at a governed cadence or after a detected regime/definition change, never merely because a stakeholder dislikes the result.
Call it from your AI
You don't wire up 388 tools in your MCP client. The GitRevio MCP server exposes 18 tools, three of which let an agent search the catalog, read a tool's schema, and run it — so the assistant finds this one on its own.
gitrevio_capabilities_search
{ "q": "decompose a randomized intervention into natural" }
→ finds "estimate_randomized_causal_mediation"
gitrevio_capability_describe
{ "capability_id": "estimate_randomized_causal_mediation" }
→ returns the input schema and agent guidance shown on this page
gitrevio_capability_run
{ "capability_id": "estimate_randomized_causal_mediation", "arguments": { ... } }
→ returns the result shown above Works in Claude Desktop, Claude Code, Cursor, Cline, Continue.dev, Goose and Aider. See the MCP server.
Related tools
Audit causal claim negative controls
Gate a causal effect claim using prespecified negative outcome/exposure controls, Benjamini-Hochberg multiplicity control, and an omnibus chi-square falsification test.
Audit cluster randomization integrity
Audit cluster-randomized experiments for practical baseline imbalance and differential outcome observation, with cluster-size-weighted standardized differences and assignment permutation diagnostics.
Audit growth incrementality experiment integrity
Audit aggregate randomized growth experiments before anyone trusts channel incrementality: enforce unique experimental units, nondegenerate logged propensities, both arms, control-spend discipline, baseline balance, spillover and evidence gates; then estimate propensity-weighted baseline-adjusted contribution, cluster-unit bootstrap uncertainty and incremental return on spend.
Audit joint outcome network integrity
Audit whether a company-specific Bayesian joint-outcome network is fit for reliance by validating point-in-time lineage, DAG and CPT completeness, effective support, protected-attribute exclusions, and strictly out-of-time outcome calibration against a baseline.
Audit staggered rollout identification
Audit staggered team-by-team adoption with not-yet-treated controls and require every simultaneous pre-period interval to fit inside a governed equivalence margin.
Design balanced stepped wedge rollout
Assign teams or other aggregate clusters to capacity-constrained rollout waves with pair-exchange optimization of cumulative causal balance, represented population, and rollout risk.