Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

distributional_did

Read-only

Estimates treatment effects on each bin of the outcome distribution, showing which segments gain or lose probability mass. Identifies distributional shifts even when mean effects are zero.

Instructions

Treatment effect on the distribution of the outcome, bin by bin. Bins the outcome, runs Callaway-Sant'Anna on each bin indicator, and reports the effect on P(Y in bin). The per-bin effects sum to zero by construction -- treatment redistributes probability mass, it does not create it -- so the content is the SHAPE: which parts of the outcome distribution gained and which lost. A mean ATT of zero is perfectly consistent with large offsetting movements in the tails, and this is what shows them. R didFF::distDD. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Known limitations: reports point estimates and standard errors only; the reference runs no test here and neither does this; simultaneous (uniform) confidence bands over bins are not implemented; the standard errors are pointwise only, so reading several bins at once overstates joint confidence. Assumptions: parallel trends for each bin indicator; no anticipation. Pre-conditions: panel with at least one treated cohort and a comparison group; outcome takes at least two distinct values. Alternatives: sp.functional_form_test, sp.qdid, sp.cic, sp.panel_qtet. Typical minimum N:...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gYesFirst-treatment period (0 = never treated)
iYesUnit identifier
tYest parameter (str).
xNoPrimary running variable, regressor, or feature input for this estimator.
yYesOutcome variable column name or outcome array.
alphaNoSignificance level for confidence intervals and tests.
max_eNomax_e parameter (float).
min_eNomin_e parameter (float).
panelNopanel parameter (bool).
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
n_binsNoEqual-width bins, or 'auto' for the didFF rule. Bins span the WHOLE panel here (unlike functional_form_test, which bins untreated rows only): the estimand is about where treated mass ended upauto
weightsNoSampling-weight column
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.
balance_eNobalance_e parameter (int).
binpointsNoExplicit bin edges
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://.
estimatorNoestimator parameter (str).dr
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.
aggregationNoWhich aggte aggregation defines the per-bin effectgroup
anticipationNoanticipation parameter (int).
data_columnsNoOptional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads.
control_groupNocontrol_group parameter (str).nevertreated
data_sample_nNoOptional uniform random subsample size (seed=0, deterministic) — useful on huge panels.
allow_unbalanced_panelNoallow_unbalanced_panel parameter (bool).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior5/5

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

The description adds substantial context beyond the readOnlyHint annotation: it discloses known limitations (pointwise standard errors only, no tests, no uniform confidence bands), assumptions (parallel trends for each bin, no anticipation), pre-conditions, and validation tier. It also clarifies that per-bin effects sum to zero by construction. No contradiction with annotations.

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 dense with high-value information: purpose, interpretation, validation, limitations, assumptions, pre-conditions, and alternatives. It is front-loaded with the core purpose)Skip. However, it ends with an incomplete 'Typical minimum N:...' and includes minor redundancy (e.g., 'bin by bin' repeated), yet every other sentence earns its place.

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

Completeness5/5

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

Given the tool’s complexity (24 parameters) and the presence of an output schema and readOnlyHint, the description covers essential operational context: what the tool does, how to interpret output, known limitations, assumptions, pre-conditions, and alternatives. Nothing critical for an agent to select and invoke the tool correctly appears missing.

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

Parameters3/5

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

The input schema has 100% description coverage, so the schema carries the parameter documentation burden. The main description supplements methodology (e.g., explaining binning and the interpretation of per-bin effects) but does not add specific parameter-level details beyond what the schema already provides. Baseline 3 is appropriate.

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

Purpose5/5

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

The description states a precise verb+resource: 'Treatment effect on the *distribution* of the outcome, bin by bin.' It details the method (bins outcome, runs Callaway-Sant'Anna per bin) and the specific estimand (P(Y in bin)). It distinguishes itself from mean ATT and explicitly names sibling alternatives (sp.functional_form_test, sp.qdid, sp.cic, sp.panel_qtet), making its scope unambiguous.

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 implies when to use this tool ('A mean ATT of zero is perfectly consistent with large offsetting movements in the tails, and this is what shows them') and lists alternatives, but it does not explicitly state the conditions that would favor an alternative over this tool. Pre-conditions (panel, treated cohort, outcome takes at least two distinct values) provide some guidance.

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