Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

did_had

Read-only

Estimates heterogeneous-adoption treatment effects using quasi-untreated groups, returning event-study estimates, diagnostics, and verdicts for evidence-backed causal decisions.

Instructions

Heterogeneous-adoption DiD using quasi-untreateded groups. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYesColumn names. ``treat`` is the dose, not an indicator.
timeYesColumn names. ``treat`` is the dose, not an indicator.
alphaNo1 - alpha confidence level.
groupYesColumn names. ``treat`` is the dose, not an indicator.
treatYesColumn names. ``treat`` is the dose, not an indicator.
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
kernelNoDefault epanechnikov, matching ``did_had``.epanechnikov
dynamicNoScale effect l by the average **cumulative** dose from F to ``F-1+l`` instead of the dose at ``F-1+l``. The current-dose normalization is right under a static model, the cumulative one under a dynamic model where past treatment still matters.
effectsNoNumber of event-study effects. Effect l is the effect at period ``F-1+l``, i.e. l periods after adoption.
placeboNoNumber of placebo estimates, built symmetrically: the ``F-1`` to ``F-1+l`` evolution is replaced by ``F-1`` to ``F-1-l``, with the dose taken from the matching post period.
yatchewNoReport the Yatchew differencing test alongside each horizon. Effects are tested for **linearity** in the dose (order 1), placebos for **mean independence** of the pre-period evolution from the future dose (order 0). Theorem 5 of the paper: with (quasi-)untreated groups, plain OLS of the evolution on the dose is unbiased for the same estimand *iff* that conditional expectation is linear. Failing to reject therefore licenses the far simpler estimator; rejecting says the nonparametric machinery is doing real work.
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.
bandwidthNoBandwidth for the local polynomial fit at dose zero -- one value, or one per reported horizon (placebos first, then effects). **Required for now.** Stata's default ``bw_method('mse-dpi')`` selector is not yet implemented; see Notes.mse-dpi
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.
trends_linNoAllow group-specific linear trends, estimated from each group's ``F-2`` to ``F-1`` evolution and subtracted. Costs one placebo, and needs at least three pre-treat periods.
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

C2.5/5.0
Behavior3/5

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

Annotations provide readOnlyHint=true, so the agent already knows this is a safe read-only estimation call. The description adds little beyond the 'quasi-untreated groups' method label and a vague validation-tier statement. It does not disclose behavioral details like required bandwidth, caching via as_handle, or failure modes; however, it does not contradict the annotations either.

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

Conciseness2/5

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

The description is short but not effectively concise: it contains a typo ('quasi-untreateded') and the 'Validation: validated evidence tier' sentence reads as truncated metadata rather than useful guidance. It front-loads a method name but wastes the second sentence on a status label. Every sentence should earn its place; neither sentence fully does.

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

Completeness2/5

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

This is an 18-parameter estimator with 5 required parameters and no description of its output semantics. The description does not warn that bandwidth must be supplied even though the Stata default is not implemented, does not explain the quasi-untreated assumption well enough for an LLM to confirm data eligibility, and gives no sense of what the returned result contains. The schema is rich, but the description leaves too much context unstated.

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%, and the schema itself already gives rich per-parameter descriptions for dynamic, placebo, yatchew, detail, bandwidth, and trends_lin. The description's one useful addition is framing 'treat' as a dose rather than an indicator, which reinforces the schema note. Since the description itself adds little beyond the schema, I cannot give 5, but the schema carries the burden well.

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

Purpose2/5

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

The description names a method ('Heterogeneous-adoption DiD using quasi-untreateded groups') but never states a clear verb + resource or what the tool actually returns. The typo 'quasi-untreateded' and the stilted 'Validation: validated evidence tier' phrase add confusion. With 50+ DiD siblings, this does nothing to distinguish did_had from did, did_estimate, harvest_did, gardner_did, or did_multiplegt.

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

Usage Guidelines2/5

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

The description gives no guidance about when to use this tool versus the many DiD alternatives. It does not mention the quasi-untreated assumption as a selection criterion, name any sibling, or state any exclusions. The 'validated evidence tier' note sounds like metadata about the tool's trust level, not usage direction.

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