did_had
Estimates heterogeneous-adoption treatment effects using quasi-untreated groups, returning event-study estimates, diagnostics, and verdicts for evidence-backed causal decisions.
Instructions
Heterogeneous-adoption DiD using quasi-untreateded groups. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| y | Yes | Column names. ``treat`` is the dose, not an indicator. | |
| time | Yes | Column names. ``treat`` is the dose, not an indicator. | |
| alpha | No | 1 - alpha confidence level. | |
| group | Yes | Column names. ``treat`` is the dose, not an indicator. | |
| treat | Yes | Column names. ``treat`` is the dose, not an indicator. | |
| 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 |
| kernel | No | Default epanechnikov, matching ``did_had``. | epanechnikov |
| dynamic | No | Scale effect l by the average **cumulative** dose from F to ``F-1+l`` instead of the dose at ``F-1+l``. The current-dose normalization is right under a static model, the cumulative one under a dynamic model where past treatment still matters. | |
| effects | No | Number of event-study effects. Effect l is the effect at period ``F-1+l``, i.e. l periods after adoption. | |
| placebo | No | Number of placebo estimates, built symmetrically: the ``F-1`` to ``F-1+l`` evolution is replaced by ``F-1`` to ``F-1-l``, with the dose taken from the matching post period. | |
| yatchew | No | Report the Yatchew differencing test alongside each horizon. Effects are tested for **linearity** in the dose (order 1), placebos for **mean independence** of the pre-period evolution from the future dose (order 0). Theorem 5 of the paper: with (quasi-)untreated groups, plain OLS of the evolution on the dose is unbiased for the same estimand *iff* that conditional expectation is linear. Failing to reject therefore licenses the far simpler estimator; rejecting says the nonparametric machinery is doing real work. | |
| 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. | |
| bandwidth | No | Bandwidth for the local polynomial fit at dose zero -- one value, or one per reported horizon (placebos first, then effects). **Required for now.** Stata's default ``bw_method('mse-dpi')`` selector is not yet implemented; see Notes. | mse-dpi |
| 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. | |
| trends_lin | No | Allow group-specific linear trends, estimated from each group's ``F-2`` to ``F-1`` evolution and subtracted. Costs one placebo, and needs at least three pre-treat periods. | |
| 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 | |||