sensitivity_rr
Assess causal estimates' robustness to parallel-trends violations via Rambachan-Roth honest-DiD sensitivity analysis. It computes breakdown Mbar (largest allowed violation) and robust confidence sets for the post-treatment ATT.
Instructions
Rambachan-Roth (2023) honest-DiD sensitivity analysis: computes the largest violation of parallel trends (parametrised by Mbar -- relative magnitude of the post-period violation versus the worst observed pre-period one) under which the post-treatment ATT is still different from zero at level alpha. Reports both the robust confidence sets and the breakdown Mbar. Assumptions: Pre-period violations bound the magnitude of post-period violations (relative-magnitude family); Post-treatment effects are constant across event time (relax via alternative parameter families in Rambachan-Roth 2023 Section 3). Pre-conditions: result has at least one pre-period and one post-period coefficient; result carries the variance-covariance matrix of those coefficients. Failure modes: Breakdown Mbar < 1.0 (small parallel-trends violation overturns the sign) -> The result is fragile to plausible pretrends violations; report the breakdown alongside the point estimate; Confidence set is the entire real line (Mbar grid too coarse) -> Re-run with a finer grid (n_grid=50+) or restrict Mbar to a tighter interval. Alternatives: sp.honest_did, sp.pretrends_test, sp.breakdown_m. Typical minimum N: 50.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Mbar | No | Grid of relative-magnitude bounds; default is np.linspace(0, 2, n_grid) | |
| 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 |
| method | No | Identification method | C-LF |
| n_grid | No | Mbar grid size when Mbar=None | |
| result | Yes | Event-study or DiD result with full pre/post coefficients | |
| 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 | No | 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. | |
| 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 | |||