Code for Higher-Order Income Dynamics with Linked Regression Trees, Druedahl and Munk-Nielsen, 2020).
- SAS (Used: SAS 9.4)
- Stata (Used: Stata 15)
- MATLAB + C++ compiler (Used: MATLAB 2019a with Microsof Visual Studio 2017 Community Edition)
- Python 3.7 (Used: Anaconda 2019.10)
Everything can be run from main.ipynb..
It calls:
- SAS to fetch the data (0_*.sas)
- Stata to structure the data (1_*.do)
- MATLAB to run ABB estimator (ABB/run.m)
- Python to run all other estimations and plot the results (2_*.ipynb)
- MATLAB to solve and simulate the consumption-saving model (ConSav/run.m)
All results are saved in output/.
The code can run in either online-mode or offline-mode (default). The mode is changed in the top of main.ipynb.
Online-mode: Produces the exact same results as shown in the paper, but can only be run on the Danmark Statistics severs in a project with the relvant data access (INDUPD, BEF, FAIN, IDAP). When running in online-mode the following paths should be adjusted:
- libname raw in 0_1_import_datasets.sas should point to the views for your project (default: H:/Rawdata/706248/views/).
- libname data in the 0_*.sas files should point to data/ in this directory (default:K:/workdata/706248/LRT/).
- The cd's in the 1_*.do files should be to this directory (default: K:/workdata/706248\LRT/).
Offline-mode: This option is used to run the code when not having access to the register data. This implies:
- ABB results are only simulated using the ABB process estimated on register data (saved in ABB/read_par_estimates.m)
- Data is simulated from the LRT, depth = 6, process estimated on the register data + classical measurement error (see details replication.ibynb)
- All other estimators are applied to the simulated data
- The same tables and figures are produced as in online-mode.
- Danish register data (INDUPD, BEF, FAIN, IDAP)
- Consumer price data: data/PRIS61.xlsx (from Statistikbanken.dk)
- House price data: data/EJEN6.xlsx (from Statistikbanken.dk)
- ABB/: Contains code for the ABB estimator
- censored_estimates/: Contains censored estimates
- ConSav/: Contains code for the consumption-saving model
- LRT/: Contains code for the LRT estimator
- data/: Contains raw data and some intermediate results
- dst/: Contains code for taking home code and output from the DST servers and unpacking them