event_study
Estimates dynamic treatment effects using relative-time dummies and two-way fixed effects, enabling pre-trend checks and event-time dynamics. Ideal for classical designs with uniform treatment timing.
Instructions
Traditional OLS event-study with entity and time FEs. Generates relative-time dummies around the treatment date, omits a reference period, and estimates via TWFE + optional clustered SE. Exposed for users who want the classical specification alongside CS / SA / BJS; not robust to staggered-effect heterogeneity -- use sp.sun_abraham for that. Validation: certified parity evidence. Do NOT use when: only one pre-treatment period is available -- there are no leads to test parallel trends with, so the plot cannot support a pre-trend claim; treatment timing is staggered and heterogeneous -- a pooled TWFE event study contaminates leads with other cohorts' treated periods; use sp.sun_abraham or sp.callaway_santanna. Assumptions: Parallel trends across event time; No anticipation beyond window lead; SUTVA. Pre-conditions: panel with unit x time x outcome; treat_time column gives first-treatment period (or 0/NaN). Failure modes: Staggered heterogeneity -- TWFE event-study biased -> Use sp.sun_abraham for contamination-robust event-study coefficients. Alternatives: sp.sun_abraham, sp.callaway_santanna, sp.did_imputation. Typical minimum N: 50.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| y | Yes | Outcome variable column name or outcome array. | |
| time | Yes | Time period column. | |
| unit | Yes | Unit identifier | |
| alpha | No | Significance level for confidence intervals and tests. | |
| 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 |
| window | No | (lead, lag) horizons | |
| cluster | No | Cluster identifier column for clustered standard errors. | |
| 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. | |
| covariates | No | Covariate matrix, DataFrame, or column names. | |
| ref_period | No | Reference relative-time period to omit | |
| treat_time | Yes | First-treatment period column | |
| 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. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||