Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

wooldridge_did

Read-only

Estimate cohort-specific average treatment effects for staggered adoption designs using saturated TWFE regression; recovers ATT per cohort with results equivalent to Callaway-Sant'Anna and Sun-Abraham estimators.

Instructions

Wooldridge (2021) extended TWFE (ETWFE). Saturated TWFE regression with cohort x post interactions; recovers cohort-specific ATTs. Numerically equivalent to CS / SA / BJS under the saturated specification. Validation: certified parity evidence. Do NOT use when: treatment timing is not staggered -- the extended TWFE saturation buys nothing over sp.did(method='2x2'). Cost: Like sp.etwfe: regressor count grows as O(cohorts x periods) from the saturated interactions, so the design matrix -- not the sample size -- is the binding cost. Assumptions: Parallel trends per cohort; No anticipation; SUTVA. Pre-conditions: panel with unit x time x outcome; first_treat cohort column (first period treated, 0 = never). Failure modes: Singleton cohorts with one unit -> Aggregate small cohorts or drop them. Alternatives: sp.callaway_santanna, sp.sun_abraham, sp.did_imputation, sp.etwfe. Typical minimum N: 50.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYesOutcome variable column name or outcome array.
timeYesTime period column.
alphaNoSignificance level for confidence intervals and tests.
groupYesUnit identifier
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 identifier column for clustered standard errors.
controlsNoControl-variable column names.
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.
first_treatYesFirst-treatment period; 0 = never-treated
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.7/5.0
Behavior5/5

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

Annotations already set readOnlyHint=true, so no side-effect warning is needed. The description adds valuable behavioral context: cost scaling (O(cohorts x periods) regressors), failure mode for singleton cohorts, assumptions (parallel trends, no anticipation, SUTVA), and numerical equivalence. 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.

Conciseness5/5

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

The description is dense but well-structured, with labeled sections for purpose, exclusions, cost, assumptions, pre-conditions, failure modes, alternatives, and minimum N. It is front-loaded with the core purpose and every sentence provides actionable 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 complex DID estimator, the description covers purpose, equivalence, when not to use, cost, assumptions, pre-conditions, failure modes, alternatives, and typical N. Since an output schema exists, return-value details are unnecessary; nothing essential 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 covers all 13 parameters with descriptions, so the baseline is 3. The description reinforces first_treat coding and panel pre-conditions, but it does not add substantial meaning beyond what the schema already states for group, time, y, or other parameters.

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 method (Wooldridge 2021 extended TWFE with cohort x post interactions) and outcome (cohort-specific ATTs). It also names the numerical equivalence to CS/SA/BJS and lists alternatives, so the tool is clearly distinguished from siblings like callaway_santanna or etwfe.

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

Usage Guidelines5/5

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

Explicitly says 'Do NOT use when treatment timing is not staggered' and directs the agent to sp.did(method='2x2') instead. It also lists alternatives, pre-conditions (panel structure, first_treat coding), failure modes, and typical minimum N, giving complete routing 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