A Pythonic Package for Regression Discontinuity
Project description
State of the Art RD Packages For Python
Installation
With pip for python:
pip install py_rdpackages
Important: you need to have the original rdrobust
installed in R:
install.packages('rdrobust')
Notes:
rdrobust
requires the newest version ofggplot2
so please:install.packages('ggplot2')
- The
rdrobust
andggplot2
versions in Anaconda lag behind the current release for R. Please install in R directly as opposed to through conda.
Introduction and Use
These packages are a work in progress, but are an attempt to create a wrapper to implement the wonderful RD packages found here (https://sites.google.com/site/rdpackages/rdrobust) which utilize R or Stata, so that they can be used in Python directly.
There are three packages in py_rdpackages
:
rdplot
creates plots of the regression discontinuity with a variety of options.rdrobust
does the RD and reports the regression results.rdbwselect
selects the optimal bandwidth size.
Requirements and Stability
Use of the programs requires all of the following packages in Python:
rpy2
for running R in Pythonmatplotlib
andseaborn
for producing high quality graphicspandas
,numpy
and for data manipulation and dataframe reading
Currently tested and stable for:
rdrobust
version 0.99.7ggplot2
version 3.3.0
Limitations
ryp2
produced slow pandas DF to R DF conversions, so I usepd.df.to_csv('temp_file_for_rd.csv')
as a solution and then delete that same file after doing the analysis. This should be fixed in future versions.- Of course, Python calling R and then converting back to python is not ideal. Some future version should code this from scratch.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py_rdpackages-1.0.0.tar.gz
(11.3 kB
view hashes)
Built Distribution
Close
Hashes for py_rdpackages-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f35e15a1052e3615a859aa47578feb63e43fc931e625f92ebb4b9bef5b5d4a7 |
|
MD5 | 5d8f363d00a29669939768c8714bb868 |
|
BLAKE2b-256 | 86f882aee8aea24ff65196261c8ccb61dc9bfd30babb096643b344255e8f7582 |