bunching
Estimate excess mass at a policy threshold to quantify behavioral response to kinks or notches. Provides validated evidence with diagnostics for contaminated bunching.
Instructions
Estimate bunching at a policy threshold. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: The counterfactual density would be smooth through the threshold absent the policy; Excess mass at the threshold reflects the behavioural elasticity of interest; No other discontinuity coincides with the threshold. Pre-conditions: A behavioural choice variable (earnings, hours, ...) with a known kink or notch in the budget/choice set; A visible empirical density of the running variable around the threshold. Failure modes: Round-number heaping or a coincident policy contaminates the bunching mass -> Exclude heaping points, widen the excluded region, and test the counterfactual polynomial order. Alternatives: sp.rdrobust, sp.rkd. Typical minimum N: 500.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dt | No | Change in marginal tax rate at the kink (for elasticity). E.g., 0.10 for a 10pp increase. | |
| alpha | No | Significance level. | |
| design | No | 'kink' or 'notch'. | kink |
| 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 | Number of bins on each side of the threshold. | |
| 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. | |
| bin_width | No | Width of bins. If None, computed from data range / n_bins. | |
| 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. | |
| threshold | Yes | Policy threshold (kink/notch point). | |
| poly_order | No | Order of the counterfactual polynomial. | |
| n_bootstrap | No | Bootstrap iterations for standard errors. | |
| running_var | Yes | Name of the running variable (e.g., income). | |
| bunch_region | No | (lower, upper) bounds of the bunching region. If None, uses [threshold - 2*bin_width, threshold + 2*bin_width]. | |
| data_columns | No | Optional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads. | |
| random_state | No | Random seed or RandomState for reproducible stochastic steps. | |
| data_sample_n | No | Optional uniform random subsample size (seed=0, deterministic) — useful on huge panels. | |
| exclude_region | No | Same as bunch_region unless otherwise specified. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||