rdbwselect
Selects optimal bandwidth for regression discontinuity (RD) analysis using MSE- or CER-optimal methods for sharp, fuzzy, and kink designs.
Instructions
Bandwidth selection for local polynomial RD estimation. Validation: certified parity evidence.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| c | No | RD cutoff value. | |
| p | No | Polynomial order for point estimation (1 = local linear). | |
| q | No | Polynomial order for bias correction. Default is p + 1. | |
| x | Yes | Running variable column name. | |
| y | Yes | Outcome variable column name. | |
| all | No | If True, compute and return all ten bandwidth types. | |
| covs | No | Covariate column names. When provided, the variance estimates used in bandwidth selection account for covariate adjustment, typically yielding narrower bandwidths. | |
| deriv | No | Derivative order. 0 = standard RD (jump in level), 1 = regression kink design (change in slope). | |
| fuzzy | No | Treatment variable name for fuzzy RD. The MSE being minimised is then the one for the Wald ratio rather than for the reduced form, so every stage of the cascade changes. .. versionchanged:: 1.27.0 This argument was parsed and then discarded: it was never passed to the bandwidth cascade, so ``fuzzy=`` returned the sharp bandwidth while the docstring claimed otherwise. On a two-sided noncompliance replica of the Lee 2008 senate data that is a 9% to 16% error in ``h``. Designs with **one-sided** noncompliance were unaffected, because ``rdbwselect`` itself falls back to the sharp bandwidth there (R's ``perf_comp``) -- which is also why the defect survived: the fixture in the repository was one-sided. | |
| 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 | Kernel function: 'triangular', 'uniform', or 'epanechnikov'. | triangular |
| cluster | No | Cluster variable name for cluster-robust variance estimation. | |
| bwselect | No | Bandwidth selection method. One of: - ``'mserd'`` : MSE-optimal common bandwidth (default) - ``'msetwo'`` : MSE-optimal separate left/right bandwidths - ``'msesum'`` : MSE-optimal for the sum of the two intercepts - ``'msecomb1'`` : ``min(mserd, msesum)``, per side - ``'msecomb2'`` : ``median(msetwo, mserd, msesum)``, per side - ``'cerrd'``, ``'certwo'``, ``'cersum'``, ``'cercomb1'``, ``'cercomb2'`` : the CER-optimal counterparts of the above The combination rules are applied to the finished ``h`` and ``b`` of each cascade, element-wise per side -- not stage by stage. | mserd |
| 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. | |
| 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 | |||