distributional_did
Estimates treatment effects on each bin of the outcome distribution, showing which segments gain or lose probability mass. Identifies distributional shifts even when mean effects are zero.
Instructions
Treatment effect on the distribution of the outcome, bin by bin. Bins the outcome, runs Callaway-Sant'Anna on each bin indicator, and reports the effect on P(Y in bin). The per-bin effects sum to zero by construction -- treatment redistributes probability mass, it does not create it -- so the content is the SHAPE: which parts of the outcome distribution gained and which lost. A mean ATT of zero is perfectly consistent with large offsetting movements in the tails, and this is what shows them. R didFF::distDD. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Known limitations: reports point estimates and standard errors only; the reference runs no test here and neither does this; simultaneous (uniform) confidence bands over bins are not implemented; the standard errors are pointwise only, so reading several bins at once overstates joint confidence. Assumptions: parallel trends for each bin indicator; no anticipation. Pre-conditions: panel with at least one treated cohort and a comparison group; outcome takes at least two distinct values. Alternatives: sp.functional_form_test, sp.qdid, sp.cic, sp.panel_qtet. Typical minimum N:...
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| g | Yes | First-treatment period (0 = never treated) | |
| i | Yes | Unit identifier | |
| t | Yes | t parameter (str). | |
| x | No | Primary running variable, regressor, or feature input for this estimator. | |
| y | Yes | Outcome variable column name or outcome array. | |
| alpha | No | Significance level for confidence intervals and tests. | |
| max_e | No | max_e parameter (float). | |
| min_e | No | min_e parameter (float). | |
| panel | No | panel parameter (bool). | |
| 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_bins | No | Equal-width bins, or 'auto' for the didFF rule. Bins span the WHOLE panel here (unlike functional_form_test, which bins untreated rows only): the estimand is about where treated mass ended up | auto |
| weights | No | Sampling-weight column | |
| 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. | |
| balance_e | No | balance_e parameter (int). | |
| binpoints | No | Explicit bin edges | |
| 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://. | |
| estimator | No | estimator parameter (str). | dr |
| 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. | |
| aggregation | No | Which aggte aggregation defines the per-bin effect | group |
| anticipation | No | anticipation parameter (int). | |
| data_columns | No | Optional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads. | |
| control_group | No | control_group parameter (str). | nevertreated |
| data_sample_n | No | Optional uniform random subsample size (seed=0, deterministic) — useful on huge panels. | |
| allow_unbalanced_panel | No | allow_unbalanced_panel parameter (bool). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||