Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

principal_strat

Read-only

Estimate causal effects within principal strata (e.g., compliers, always-survivors) using monotonicity or covariate-weighting methods, with bounds and bootstrap CIs.

Instructions

Principal Stratification (Frangakis & Rubin 2002). 'monotonicity' method identifies the complier PCE (= LATE) and reports Zhang-Rubin sharp bounds on the always-survivor SACE. 'principal_score' uses Ding-Lu covariate weighting to point-identify stratum-specific effects under principal ignorability. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Known limitations: Always-survivor SACE under encouragement design (Mealli & Pacini 2013, partial identification) is not yet implemented; only AIR / Wald LATE point estimates (tau_Y on outcome, tau_S on the post-treatment stratum) are reported when an instrument is supplied. Assumptions: Monotonicity (no defiers) for method='monotonicity'; Principal ignorability for method='principal_score' (strata perp Y(d) | X); SUTVA and exclusion restriction for the never-takers / always-takers interpretation. Pre-conditions: binary treatment; binary post-treatment stratum variable (compliance, survival, employment, ...); covariates required when method='principal_score' (for Ding-Lu weighting). Failure modes: Zhang-Rubin bounds include 0 and both signs -> Strata partition too weak for point ident...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYesOutcome
seedNoRandom seed for reproducible bootstrap draws
alphaNoCI level (e.g. 0.05 for 95% CIs)
treatYesBinary treatment
detailNoPayload depth: 'minimal' (~150 tokens) for sub-step calls where only the point estimate is needed; 'standard' (~1K tokens) for diagnostics + coefficient table; 'agent' (~2K tokens, default) adds violations / next_steps / suggested_functions so the LLM can plan its next call without another round-trip.agent
methodNoIdentification strategymonotonicity
n_bootNoBootstrap replications
strataYesBinary post-treatment variable
as_handleNoIf true, cache the fitted result on the server and return result_id + result_uri alongside the JSON payload so a subsequent tools/call can chain without re-running.
data_pathYesAbsolute path or URL to a data file. Supported: .csv / .tsv / .txt (delimited), .parquet / .pq, .feather / .arrow, .xlsx / .xls, .dta (Stata), .json / .jsonl. Schemes: file://, s3://, gs://, https://.
result_idNoOptional handle to a previously-fitted result (returned by an earlier call when as_handle=true). Tools that operate on a fitted object accept this in place of re-supplying data_path + columns.
covariatesNoBaseline covariates (required for principal_score)
instrumentNoBinary instrument column. When supplied, switches to the AIR / Wald LATE estimator: under random Z, monotonicity, and exclusion, reports two LATEs among Z-compliers -- tau_Y for the effect of the treatment on the outcome, and tau_S for the effect on the post-treatment stratum variable. method= is ignored on this path.
data_columnsNoOptional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads.
data_sample_nNoOptional uniform random subsample size (seed=0, deterministic) — useful on huge panels.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only provide readOnlyHint=true, so the description carries the behavioral disclosure burden. It goes well beyond the annotation by documenting known limitations, failure modes, assumption requirements, and the fact that the instrument path ignores method and reports only tau_Y and tau_S. No contradiction with annotations is present.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but well-structured and front-loaded with purpose, followed by labeled sections for validation, limitations, assumptions, preconditions, and failure modes. Most sentences earn their place; the 'Validated evidence tier' phrase is somewhat cryptic and the failure-mode sentence appears truncated, so it is not perfectly concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex causal-inference tool, the description is remarkably complete: it covers identification strategies, assumptions, preconditions, limitations, and failure behavior, while the schema handles parameter details. It falls short of a 5 because the failure-mode sentence is cut off and it never explains the 'validated evidence tier' concept or how it should affect an agent's invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds meaningful method-level semantics for method, covariates, and instrument beyond the schema's short labels, such as what each identification strategy actually computes. It does not elaborate on all 15 parameters, but the schema already documents those adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: principal stratification estimation, with two named strategies and specific outputs (complier PCE/LATE, Zhang-Rubin bounds on always-survivor SACE, Ding-Lu stratum-specific effects). It does not explicitly differentiate from adjacent sibling tools like survivor_average_causal_effect or selection_bounds, so it stops short of the top score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives concrete guidance on when to use each method: monotonicity versus principal_score, the need for covariates under principal_score, the AIR/Wald LATE path when an instrument is supplied, and relevant assumptions and preconditions. It does not name sibling tools or exclusion conditions for preferring another estimator, so it lacks the explicit 'when-not-to-use-this' routing of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools