rdrobust
Implements local polynomial Regression Discontinuity (RD) point estimators with robust bias-corrected confidence intervals and inference procedures.
What it is and what it does
rdrobust is a Python implementation of regression discontinuity design methods for causal inference, translating the methodological framework from econometrics into a usable statistical package. It provides three main functions: rdrobust for point estimation and hypothesis testing with robust bias-corrected inference, rdbwselect for data-driven bandwidth selection, and rdplot for diagnostic visualization. The package depends on numpy, pandas, scipy for numerical computation, and plotnine and matplotlib for graphical output.
The package targets applied researchers and econometricians who work with quasi-experimental designs where a treatment assignment changes sharply at a threshold. It handles heteroskedasticity-robust and cluster-robust variance estimation, supports covariate adjustment, and implements the bias-correction and coverage-error optimization methods described in the underlying academic literature. Installation is straightforward, and the package includes a bundled Senate dataset for quick experimentation.
Use it for:
- Estimate causal effects in policy evaluations where treatment is assigned based on a threshold (e.g., eligibility cutoffs)
- Conduct robust inference on discontinuities in outcome variables at known policy discontinuities
- Select optimal bandwidth for RD estimation automatically using data-driven procedures
- Generate diagnostic plots of RD relationships with binned means and local polynomial fits
- Perform cluster-robust inference when observations are grouped (e.g., by state or region)
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Implements regression discontinuity (RD) design estimation, inference, and plotting using local polynomial methods with robust bias-corrected confidence intervals.
Yes, if you work with regression discontinuity designs in econometrics or causal inference. The package is actively maintained, has no known vulnerabilities, installs with low friction, and implements state-of-the-art bias-corrected methods backed by peer-reviewed research. The GPL-3.0-only license is a constraint only if you need to incorporate it into proprietary software.
Install
rdrobust on PyPI
pip
pip install rdrobustuv
uv add rdrobustpoetry
poetry add rdrobustInstalling rdrobust
Before you install
Low friction installation with five common scientific dependencies (numpy, pandas, scipy, plotnine, matplotlib). Actively maintained with recent releases; last commit 2026-08-14.
License in practice
GPL-3.0-only copyleft license requires any derivative work or distribution to also be GPL-3.0-only; acceptable for research and open-source projects but incompatible with proprietary software.
Quickstart
pip install rdrobust
from rdrobust import rdrobust, rdrobust_RDsenate
df = rdrobust_RDsenate()
r = rdrobust(y=df['vote'], x=df['margin'], vce='hc3')
Requires Python >= 3.9
Verify before relying
- Whether cluster-robust variance (CRV3) implementation matches Pustejovsky-Tipton 2018 exactly as claimed
- Performance characteristics with large datasets (memory footprint, computation time)
- Compatibility with pandas/numpy versions beyond the minimum supported
Package facts
| License | GPL-3.0-only (copyleft) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — numpy, pandas, scipy, plotnine, matplotlib |
| Maintenance | actively maintained — 91 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 89,822/month — #13,632 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: rdrobust-2.0.0-py3-none-any.whl
Tags
More Mathematics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
kiwisolverkiwisolver is a Python binding to a fast C++…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
ropwrRoPWR computes optimal piecewise polynomial…
permissive · top 15,000 on PyPI
econmlEconML estimates heterogeneous treatment…
permissive · top 15,000 on PyPI
dowhyDoWhy is a Python library for causal inference…
permissive · top 15,000 on PyPI
pydoePyDOE constructs experimental designs for…
permissive · top 5,000 on PyPI
pyfixestPyFixest performs fast high-dimensional fixed…
permissive · top 15,000 on PyPI
linearmodelsProvides panel regression, instrumental…
unclear · top 15,000 on PyPI
pyDOE3pyDOE3 provides functions to construct…
permissive · top 15,000 on PyPI
quantile-forestQuantile regression forests for estimating…
permissive · top 15,000 on PyPI
mgwrCalibrates multiscale and traditional…
permissive · top 15,000 on PyPI
spregspreg estimates simultaneous autoregressive…
permissive · top 15,000 on PyPI