Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

spillover_did

Read-only

Estimate direct and indirect treatment effects with difference-in-differences using distance-based rings and clean controls beyond the outer ring to avoid contamination.

Instructions

Butts spillover-ring DiD. The usual fix -- a spatial lag of treatment in a TWFE regression -- measures the direct effect against controls the spillover already reached. This sorts untreated units by distance to the nearest treated unit into spillover rings plus CLEAN controls beyond every ring, and estimates the direct effect and each ring's effect against the clean controls only. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Known limitations: there is no reference implementation, so this carries design-recovery evidence only and no cross-language parity; ring boundaries are the analyst's choice; there is no selector, and a too-wide outer ring silently contaminates the clean controls; covariate adjustment is not implemented. Assumptions: Parallel trends between each group and the clean controls; Spillovers vanish beyond the outermost ring; No anticipation. Pre-conditions: unit positions or a distance matrix; some untreated units beyond the outermost ring. Failure modes: No clean controls -> Every untreated unit is inside a ring. Narrow ring_edges or widen the study area; Ring effects do not decay with distance -> The outer...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYesOutcome variable column name or outcome array.
timeYesTime period column.
unitYesUnit identifier column.
alphaNoSignificance level for confidence intervals and tests.
cohortYesFirst-treatment period (never_value = never)
coordsNoTwo columns giving each unit's position (Euclidean)
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
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://.
distancesNoPre-computed distance matrix, for great-circle or network distances
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.
ring_edgesNoRing boundaries; untreated units beyond the last edge are the clean controls
never_valueNonever_value parameter.
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.4/5.0
Behavior5/5

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

The description is exceptionally transparent: it discloses the validation evidence tier, known limitations (no reference implementation, no selector, ring contamination risk), assumptions, and failure modes. This goes well beyond the readOnlyHint annotation and provides rich behavioral context for the agent.

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, front-loading the method and then systematically covering validation, limitations, assumptions, pre-conditions, and failure modes. Each section adds value; while it could be trimmed slightly, it's appropriately detailed for a complex method.

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 (15 params, output schema, annotations), the description covers all necessary aspects: method logic, assumptions, pre-conditions, failure modes, and validation evidence. Nothing an agent needs to decide correct usage is 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?

Schema coverage is 100%, so the baseline is 3. The description adds conceptual context (e.g., ring_edges meaning, clean controls) but doesn't significantly enhance parameter-specific syntax beyond the schema's own descriptions.

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 clearly states the tool's function: it sorts untreated units into spillover rings and estimates direct and ring effects against clean controls, contrasting with the 'usual fix' of a spatial lag TWFE. This distinguishes it from the sibling 'spillover' tool and other DiD estimators.

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?

It describes the method's purpose relative to the 'usual fix' and outlines pre-conditions and failure modes (e.g., no clean controls, ring boundaries choice), which guide when to use it. However, it doesn't explicitly name alternative tools or state 'use this instead of X', leaving some inference required.

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