Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

did_multiplegt_dyn

Read-only

Estimate dynamic treatment effects via intertemporal event-study DiD, comparing outcome changes between first-time switchers and not-yet-treated or never-treated controls across pre/post horizons.

Instructions

[experimental] dCDH (2024) intertemporal event-study DiD (MVP -- see docs/rfc/multiplegt_dyn.md). At each horizon l in {-placebo, ..., dynamic}, compares Y_{F+l} - Y_{F-1} between units first switching at F and a not-yet-treated or never-treated control set held stable across the horizon. MVP caveats: analytical influence-function variance [pending verification] is not yet implemented (SE via cluster bootstrap); switch-off events are ignored; heteroskedastic-weights variant pending. Validation status: experimental. Known limitations: switch-off events are handled, but the heteroskedastic-weights variant (dCDH 2023 EJ survey) is not implemented; se_method='analytic' is available but the paper's own variance formula is not implemented: it is not pinned to DIDmultiplegtDYN and runs about 1% below its reported SEs; the headline aggregation convention differs from DIDmultiplegtDYN's Av_tot_eff: the default weights horizons equally; pass aggregation='switchers' to match the R package. Cost: Bootstrap inference dominates: total runtime is roughly n_boot x (one full estimation pass). The default n_boot is fine for a final table but expensive inside a search loop -- lower it while iter...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYesOutcome variable column name or outcome array.
seedNoRandom seed for reproducible stochastic steps.
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
n_bootNoNumber of bootstrap replications.
clusterNoCluster column (defaults to group)
controlNoControl groupnot_yet_treated
dynamicNoNumber of post-treatment dynamic horizons
placeboNoNumber of pre-treatment placebo horizons
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.
se_methodNo'bootstrap' resamples clusters; 'analytic' uses the influence functions (~100x faster, but NOT pinned to DIDmultiplegtDYN -- about 1% below its reported SEs)bootstrap
switchersNoEstimate on switch-in ('in') or switch-out ('out') events only. Stata's switchers(); default pools both.
treatmentYesBinary treatment (0/1), switch-on only in MVP
aggregationNoHeadline weighting over dynamic horizons: 'simple' (equal weight) or 'switchers' (weight by switchers per horizon -- reproduces DIDmultiplegtDYN's Av_tot_eff)simple
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.
effects_equalNoTest H0 that the dynamic effects are all equal. True tests every effect; a (lower, upper) pair tests that horizon range. Stata's effects_equal().
same_switchersNoRestrict the treated arm to switchers observed at every requested horizon, holding the composition fixed across relative time. Stata's same_switchers.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

C2.9/5.0
Behavior2/5

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

The description is transparent about experimental status, bootstrap cost, and SE caveats, which the readOnlyHint alone would not convey. However, it contains internal contradictions: switch-off events are both 'ignored' and 'handled', and analytic variance is both 'not yet implemented' and 'available', undermining trust in the behavioral disclosure.

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 long, repeats caveats, and ends mid-sentence ('lower it while iter...'). Bold section labels help, but redundancy and internal contradiction mean not every sentence earns its place.

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

Completeness3/5

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

For a complex experimental estimator, the description covers many operational concerns: validation status, variance implementation, aggregation convention, and cost. Completeness is undercut by contradictory switch-off and variance statements and by the lack of a clear use-vs-alternative statement.

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%, so the baseline is 3. The description adds value by explaining the n_boot runtime tradeoff and clarifying that aggregation='switchers' reproduces DIDmultiplegtDYN's Av_tot_eff, though much of the se_method and aggregation detail is already in the schema.

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

Purpose4/5

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

The description identifies the estimator precisely: an intertemporal event-study DiD following dCDH (2024), with a concrete comparison formula across horizons. It is specific enough to distinguish from generic DiD tools, though it never explicitly names a sibling alternative such as 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 caveats and limitations but no explicit guidance on when to choose this tool over alternatives or when not to use it. The contradictory statements about switch-off events ('ignored' vs 'handled') make usage guidance unreliable.

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