Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

lp_did

Read-only

Estimate dynamic treatment effects over event time via local-projections DiD, with cluster-robust standard errors and not-yet-treated or never-treated controls.

Instructions

Local-Projections DiD (Dube-Girardi-Jorda-Taylor 2023). At each event-time horizon h in {-P, ..., H}, runs a separate OLS of Y_{t+h} - Y_{t-1} on the treatment change Deltad_{t} with time FE and cluster-robust SE, using 'not-yet-treated' or 'never-treated' units as controls. Event-study beta_h paths are returned in model_info['event_study']. Validation: certified parity evidence. Assumptions: Parallel trends across event time (standard DiD); No anticipation within the pre-treatment horizon; SUTVA. Pre-conditions: long-format panel with consecutive integer time; treatment is binary 0/1 and time-varying; horizons feasible: enough periods for Y_{t-1} and Y_{t+H}. Failure modes: Horizon-0 n_obs is tiny because few units switch on in the clean-control window -> Widen clean_controls='never_treated' -> 'not_yet_treated' or shorten horizons; Placebo CIs don't cover zero -- parallel trends suspect -> Apply sp.honest_did to the event-study paths for Rambachan-Roth sensitivity bounds. Alternatives: sp.callaway_santanna, sp.sun_abraham, sp.did_imputation, sp.gardner_did. Typical minimum N: 100.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYesOutcome variable column name or outcome array.
timeYesInteger period (consecutive)
unitYesUnit identifier
alphaNoSignificance level for confidence intervals and tests.
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
clusterNoCluster variable (defaults to unit)
time_feNotime_fe parameter (bool).
controlsNoControl-variable column names.
horizonsNo(min, max) event-time horizons to estimate
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.
treatmentYesBinary time-varying treatment (0/1)
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.
clean_controlsNoControl selectionnot_yet_treated

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true, so the safety profile is covered. The description adds substantial behavioral context: it runs many regressions per horizon, returns event-study paths in a specific field, documents assumptions (parallel trends, no anticipation, SUTVA), and discusses failure modes (tiny horizon-0 n_obs, placebo CIs) with concrete remedies. This goes well beyond the annotations and helps the agent anticipate and diagnose issues.

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 densely packed and organized with labeled sections (Validation, Assumptions, Pre-conditions, Failure modes, Alternatives). The core method is front-loaded. Some phrases, such as 'Validation: certified parity evidence,' are vague, and the length could be trimmed slightly, but most clauses contribute useful information.

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?

For a tool with 16 parameters and an output schema, the description covers the method, assumptions, pre-conditions, failure modes, alternatives, and minimum sample size. It does not need to restate schema details. An agent has everything needed to select the tool correctly, understand data expectations, and troubleshoot common failures.

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?

The input schema has 100% description coverage for all 16 parameters, so the baseline is 3. The description adds value by explaining the role of clean_controls (not_yet_treated vs never_treated) and horizon feasibility, tying them to failure modes and fixes. This supplements the schema rather than repeating it.

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 specific estimator (Local-Projections DiD) and gives a precise econometric specification: separate OLS of Y_{t+h} - Y_{t-1} on Deltad_t with time FE and cluster-robust SE. It also names the authors and the key output (event-study beta_h paths in model_info['event_study']). This clearly distinguishes it from sibling DiD estimators and even lists alternatives.

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 provides concrete pre-conditions (long-format panel, consecutive integer time, binary time-varying treatment, feasible horizons) and a typical minimum N. It lists alternative estimators (callaway_santanna, sun_abraham, did_imputation, gardner_did) but does not give an explicit 'use this when X, use that when Y' decision rule. The context is clear but lacks explicit exclusions or selection criteria.

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