Data and Code

This page provides links to a number of replication packages, for a number of papers that I co-authored.  The code is provided "as is", i.e. with intent to replicate our results and in order to be helpful for researchers interested in using our data / techniques in their own research, with no further commitment from my co-authors or me.  The code is usually written in R or Stata, and recently a little bit of Julia. Please when re-using the code and data, refer to the paper with citations listed below.


The code archive for this paper contains our latest version of R and Julia code for computing counterfactual trade policy analysis (Exact Hat Algebra).  We recommend to use those rather than the Stata ones from the 2014 Handbook chapter (because of faster speed and also additional features like the incorporation of intermediates).  The version in Julia is particularly fast, hence particularly  useful if you want to explore large numbers of parameter values.


Data used is the original BLP 1995/1999 data. The code (in R) consists  mostly of simulations of the BLP Data Generating Process and variations thereof, but also BLP estimation using Colon and Gortmaker PyBLP package.  The paper and code also explains how to run Exact Hat Algebra for oligopolistic environments. 


The code (in R) replicates all gravity regressions in the paper with long-run datasets intended to evaluate market integration for goods, services, capital and labour in Europe since the 1960s. 

The data contains among other things an up-to-date gravity dataset for goods at the world level which includes trade-with-self (1960-2018). 



The code on this webpage uses Stata to run monte-carlo simulations and counterfactual computations among many other things. The data is the CEPII gravity data available at the time, and a more recent version is now available on their website.  Regarding counterfactual simulations, much faster R  and Julia code are available in the "Balkans"  section of this webpage.