Replication archive for Solleder, Silvy, and Olarreaga (2025)
Abstract
This is the replication archive for the paper Please see the readme file for more information.
Full text
Replication Archive Readme for Protection for Sale without Aggregation Bias∗ Jean-Marc Solleder† , Fulvio Silvy‡ , Marcelo Olarreaga§ October 2025 1 Introduction This document describes the content of the replication archive of the paper Protection for Sale without Aggregation Bias and details how to generate the tables and figures of the article. The replication comprises two main parts: •Tables and figures related to the Protection for Sale (PFS) estimation; •Estimation of production at the HS-6 level and generation of tables and figures related to production. The following sections describe each of these two components in turn. 2 Tables and Figures for PFS This section outlines the steps to replicate Tables 1, 5, and 6, as well as all figures in the paper. The Code folder of the archive contains two files: Tables_figures.do and Intermediates_Tables_figures.do. ∗The project is funded by the SNF grant # 100018-204533. †University of Geneva and FERDI. E-mail: [email protected]h ‡University of Geneva. E-mail: [email protected] §University of Geneva, CEPR and FERDI. E-mail: [email protected]h 1
The first file, Tables_figures.do, starts from the intermediate files containing the PFS model estimations stored in the estimates subfolder to generate the graphs. The second file actually performs the model estimations prior to constructing the graphs. Both files replicate the tables and figures of the paper; the only difference lies in execution time, as the PFS estimations are time-consuming. Tables and figures are identified by a section in the code. 3 Estimating and Testing Production 3.1 Estimating Production The final production file prod_20250928_new_prod_rerf.dta is provided so that the reader does not need to estimate production to generate the tables and figures in the article. See Section 3.3. To estimate production, the reader will need the following files from the Production subfolder: •production.do •data.7z •Launch_statas.bat To launch the estimation, decompress data.7z1into a folder. Note that while the compressed file is smaller than 3 GB, the uncompressed version is slightly larger than 35 GB. Once this is done, copy production.do and Launch_statas.bat into the same directory, launch a Windows Command Prompt or PowerShell, and run Launch_statas.bat.2This will launch 12 instances of Stata in parallel (see comments in the note below) and should run for a significant amount of time, approximately one week with the processing power at our disposal. 1The archive can be decompressed using 7-Zip, available on many platforms. See https://www.7-zip.org/. 2You may need to adjust the path to your Stata installation in the Launch_statas. bat file. 2
3.2 Notes on Estimating Production The archive data.7z contains all data files required to estimate production. This includes the World Bank indicators used in the study, CITE data on educational attainment, COMTRADE net exports, PRODCOM production data converted to HS 6-digit, and our own gravity estimates. The estimation was performed on a Windows workstation running Stata 17. The ssc commands needed for the estimation are listed at the top of the production.do file. The code ensures reproducibility by setting: 1version 17.0 2version 17.0 , user 3// and at the beginning of each iteration : 4set seed 1234 We encountered some issues replicating the results on other platforms. This is likely due to discrepancies in either the Java interpreter used by the rforest command3or differences in math libraries across platforms. To obtain consistent results, we advise the reader to run the code on an infrastructure similar to ours. The total process of estimating the production data is lengthy. As the problem is embarrassingly parallel, we managed to complete the full set in one week by running 12 instances of Stata simultaneously on a single workstation. To do this, the Stata script performing the job, production.do, takes two parameters (chunk and max_chunk) that divide the HS codes to process into max_chunk blocks and estimate only block chunk. The script Launch_statas .bat calls all Stata instances in turn. The number of parallel instances can be adjusted in the Launch_statas.bat file by replacing “12” in the definition of the for loop and in the call to production.do. The value of 12 was chosen because Stata, even in Stata-MP, remains mostly single-threaded for this estimation, and the processor available had 12 cores. Running 12 instances in parallel, therefore, utilized the processing power efficiently while avoiding bottlenecks. Listing 1: File Launch_statas.bat 1@echo off 2REM --- Path to StataMP executable --- 3We used the built-in Java interpreter, which identifies as version 17.011. Note also that each call to the Java-backed rforest command sets its own seed to 1234. 3
3set STATA="C :\ Program Files \ Stata17 \ StataMP -64. exe " 4 5REM --- Run 12 workers in parallel ( parameters 1..12) --- 6for /L %% i in (1 ,1 ,12) do ( 7start "" % STATA % /e do production . do %% i 12 8timeout /t 20 / nobreak >nul 9) 10 11 echo All 12 Stata jobs launched . 3.3 Testing Production (Tables 2 to 4 of the Paper) The file Tests.do contains all the code needed to replicate Tables 2 to 4 of the paper. Each table is identified by a section in the code. All data required for replication are provided, and the user does not need to unpack the very large data.7z file to run this script. 4