This repository will contain R, Stata, and Python packages, all called causaldata
, which contain data sets that can be used to implement the code examples in causal inference textbooks.
As of the moment, this contains data sets from The Effect by Huntington-Klein, Causal Inference: The Mixtape by Scott Cunningham, and Causal Inference: What If? by Hernán and Robins. The judge_fe
data set from The Mixtape is too large to include, and so is omitted.
Data sets all come with documentation in the form of variable labels, although the exact format of this varies from language to language.
The R package can be installed with:
install.packages('causaldata')
# Or dev version (currently identical):
# If necessary: install.packages('remotes')
remotes::install_github('NickCH-K/causaldata/R/')
The Stata package can be installed with:
ssc install causaldata
* Or for the dev version (currently identical)
net install causaldata, from("https://raw.githubusercontent.com/NickCH-K/causaldata/master/Stata/")
To install the Python package, do
pip install causaldata
For the dev version (currently identical), use the green Code button on this page to download this repository, unzip it, change the directory to the causaldata/Python
folder, and install with:
python setup.py install
Or, if you're using something with IPython like Spyder, you might use
runfile('the/full/path/to/causaldata/Python/setup.py', wdir='your/working/directory',args='install')