Replication code for: "Discretizing Unobserved Heterogeneity", by Bonhomme, Lamadon and Manresa
Download the latest zip file with all results and source code:
This repository contains all the code to replicate the results presented in the paper. Reproducing the results should be close to be as simple as typing make all
in your terminal. See however the required dependencies below.
As an alternative we provide a separate repository with a pip package and notebooks written in python to reproduce the results from the first model of the paper. You can launch the notebook either on google colab or using binder:
- The matlab folder contains the code to generate the simulations used in the paper
- The Makefile can be used to regenerate all the results. Each matlab file can also be used to generate individual results where parameters can be changed easily
- The results folder contains the results that we generate for the paper using the random seed defined in the makefile
- To generate the mat files you only need access to matlab. You can use the
makefile directly with
make sims
- To generate the table and plots from the mat files you will need a few
python dependencies. You can either:
- install then by using the provided conda environment file:
conda env create --file conda-env.yml
and then activatingblm2-env
- install it through pip with
pip install numpy pandas matplotlib tqdm seaborn scipy
- install then by using the provided conda environment file:
- To compile the tables you need a working copy of latex.
The matlab folder contains 6 matlab files:
-
Code_Earnings_Time_Invariant.m
replicates Figure 1 in the paper and Table S1 in the Supplemental Material -
Code_Probit_Time_Varying.m
replicates Figure 2 in the paper and Table S2 in the Supplemental Material -
Code_Probit_Time_Invariant_BinaryCov.m
replicates Table S3 in the Supplemental Material -
lik.m
,lik_bb.m
, andlik_IFE2.m
are functions to compute the likelihood function and scores & hessians of probit models.
Thank you for using our codes.
For any feeback, please contact:
- Stephane at [email protected]
- Thibaut at [email protected]
- Elena at [email protected]