Commit 2104cf1
feat(rd): comprehensive RDD mega-upgrade — 6 new modules + major enhancements
New modules (6 files, ~6000 lines):
- bandwidth.py: Full bandwidth selection suite (8 methods: MSE/CER × common/separate/comb1/comb2)
with fuzzy-specific and covariate-adjusted support (Calonico-Cattaneo-Farrell 2020)
- locrand.py: Local randomization inference framework (rdrandinf, rdwinselect, rdsensitivity,
rdrbounds) with Fisher exact tests and Rosenbaum bounds (Cattaneo-Titiunik-VB 2016)
- hte.py: Heterogeneous treatment effects via fully interacted local linear model (rdhte,
rdbwhte, rdhte_lincom) with Wald heterogeneity test (Calonico et al. 2025)
- rd2d.py: Boundary discontinuity / 2D RD designs with distance-based and location-based
approaches, bivariate local polynomial (Cattaneo-Titiunik-Yu 2025)
- extrapolate.py: External validity — Angrist-Rokkanen extrapolation (OLS/IPW/AIPW),
multi-cutoff extrapolation, external validity diagnostics
- rdml.py: ML+RD methods — Causal Forest, Gradient Boosting, LASSO-assisted RD,
unified CATE summary with variable importance
Major upgrades to existing modules:
- rdrobust.py: Covariate-adjusted local polynomial estimation (covariates in design matrix
per Calonico et al. 2019), 8 bandwidth selectors (CER-optimal added), weights support,
IMSE-optimal binning for rdplot, weighted global polynomial fits, pointwise CI bands
- diagnostics.py: Enhanced rdsummary with full=True mode (honest CI, power analysis,
placebo tests, bandwidth comparison), multi-panel diagnostic dashboard plot
- __init__.py: All 30+ new public functions exported at sp.xxx level
57 tests pass (25 existing + 32 new). Total RD module: 10,298 lines across 14 files.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 594461d commit 2104cf1
11 files changed
Lines changed: 7280 additions & 117 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
47 | 55 | | |
48 | 56 | | |
49 | 57 | | |
| |||
164 | 172 | | |
165 | 173 | | |
166 | 174 | | |
| 175 | + | |
| 176 | + | |
167 | 177 | | |
168 | 178 | | |
169 | 179 | | |
| |||
264 | 274 | | |
265 | 275 | | |
266 | 276 | | |
| 277 | + | |
267 | 278 | | |
268 | 279 | | |
269 | 280 | | |
270 | 281 | | |
271 | 282 | | |
272 | 283 | | |
273 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
274 | 299 | | |
275 | 300 | | |
276 | 301 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
12 | 40 | | |
13 | 41 | | |
14 | 42 | | |
| 43 | + | |
15 | 44 | | |
16 | 45 | | |
17 | 46 | | |
18 | 47 | | |
19 | 48 | | |
20 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
21 | 55 | | |
22 | 56 | | |
23 | 57 | | |
24 | 58 | | |
25 | 59 | | |
| 60 | + | |
26 | 61 | | |
27 | 62 | | |
28 | 63 | | |
| |||
37 | 72 | | |
38 | 73 | | |
39 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
40 | 92 | | |
0 commit comments