did_multiplegt_dyn
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
| Name | Required | Description | Default |
|---|---|---|---|
| y | Yes | Outcome variable column name or outcome array. | |
| seed | No | Random seed for reproducible stochastic steps. | |
| time | Yes | Time period column. | |
| alpha | No | Significance level for confidence intervals and tests. | |
| group | Yes | Unit identifier | |
| detail | No | Payload 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_boot | No | Number of bootstrap replications. | |
| cluster | No | Cluster column (defaults to group) | |
| control | No | Control group | not_yet_treated |
| dynamic | No | Number of post-treatment dynamic horizons | |
| placebo | No | Number of pre-treatment placebo horizons | |
| as_handle | No | If 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_path | Yes | Absolute 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_id | No | Optional 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_method | No | 'bootstrap' resamples clusters; 'analytic' uses the influence functions (~100x faster, but NOT pinned to DIDmultiplegtDYN -- about 1% below its reported SEs) | bootstrap |
| switchers | No | Estimate on switch-in ('in') or switch-out ('out') events only. Stata's switchers(); default pools both. | |
| treatment | Yes | Binary treatment (0/1), switch-on only in MVP | |
| aggregation | No | Headline weighting over dynamic horizons: 'simple' (equal weight) or 'switchers' (weight by switchers per horizon -- reproduces DIDmultiplegtDYN's Av_tot_eff) | simple |
| data_columns | No | Optional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads. | |
| data_sample_n | No | Optional uniform random subsample size (seed=0, deterministic) — useful on huge panels. | |
| effects_equal | No | Test 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_switchers | No | Restrict the treated arm to switchers observed at every requested horizon, holding the composition fixed across relative time. Stata's same_switchers. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||