The `rdrobust` Python library (current version 1.3.0) implements local polynomial Regression Discontinuity (RD) point estimators with robust bias-corrected confidence intervals and inference procedures. It is actively maintained and regularly updated, with releases typically aligning with new features or improvements to the underlying R/C++ codebase it wraps.
pip install rdrobustVerified import paths — ran on the pinned version, not inferred.
This example simulates data for a regression discontinuity design around a cutoff at `c=0`. It then applies the `rdrobust` function to estimate the treatment effect at the cutoff using the default robust bias-corrected method. It demonstrates preparing data as Pandas Series and accessing the structured output object's summary.
Convert Python lists to `np.array()` or `pd.Series()` before passing them to `rd.rdrobust()`.
Ensure that `min(x) <= c <= max(x)`. Adjust the cutoff value or filter your dataset as necessary.
Consult the `rdrobust` documentation for details on bandwidth selection. Consider trying alternative bandwidths or implementing sensitivity checks to assess the robustness of your results.
For multiple sharp cutoffs, run `rdrobust` separately for each. For fuzzy RD, consider other packages or methodologies tailored for that design.
Convert your Python lists to NumPy arrays (`np.array(my_list)`) or Pandas Series (`pd.Series(my_list)`) before passing them to `rd.rdrobust()`.
Verify that `min(x) <= c <= max(x)`. Adjust `c` to be within the observed range of `x` or ensure your data is appropriately pre-processed.
Use `r.summary()` to get a comprehensive, formatted overview of all results. To access specific values, inspect the object's attributes (e.g., `dir(r)` or `r.__dict__`) or refer to the `rdrobust` documentation. Often, p-values, estimates, etc., are stored in arrays like `r.p_values[0]` or `r.estimate[0]`.
Open your terminal or command prompt and run `pip install rdrobust`. If using virtual environments, ensure the correct environment is activated before running your Python script.