R, Python and Stata code for
Data Analysis for Business, Economics, and Policy
by Gábor Békés (CEU) and Gábor Kézdi (U. Michigan)
Published on 6 May 2021 by Cambridge University Press
gabors-data-analysis.com
All code available for R, Stata and Python. To see options for various languages, check out:
- R -- How to run code in R
- Stata -- How to run code in Stata
- Python -- How to run code in Python
On the textbook's website, we have detailed discussion of how to set up libraries, get data: Overview of data and code
Alternatively, you can also run Python and R codes in GitHub Codespaces with pre-configured environments. You can read more details on Codespaces here. To start a Codespace for your desired language, press one of the buttons below:
Click to open Codespaces with Python environment:
Click to open Codespaces with R environment:
The Latest release, 0.9.0 "Frank Exchange of Views" was released 14 August 2025.
Overall, the transition to seaborn and pyfixest drove most of the Python‑side evolution, while the R side adopted fixest/marginaleffects. Stata materials remained largely stable, reflecting a focus on modernizing the Python and R components for reproducibility and ease of use. No Julia yet. See detailes in the changelog / release notes.
- Each case study has a separate folder.
- Within case study folders, codes in different languages are simply stored together.
- Data should be downloaded and stored in a separate folder.
- R -- We used R 4.0.2.
- Stata -- We used version 15, allmost all code should work in version 13 up.
- Python -- We used Python 3.12.0.
Data is hosted on OSF.io
Awesome, we know there are errors and bugs. Or just much better ways to do a procedure.
To make a suggestion, please open a github issue here with a title containing the case study name. You may also contact us directctly. Cheers!