%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GENERAL INFORMATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%% This file contains details on how to prepare the data and estimate the reduced-form and structural models in Glitz and Vejlin "Learning through Coworker Referrals" (RED, 2020). Operating system: CentOS Linux 7 (Core) Software: Stata/SE 13.1, Matlab, R2017b (9.3.0.713579) 64-bit (glnxa64) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ZIP FILE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The ZIP-file ProgramsFinal contains 1) a set of programs decscribed in detail below and 2) a subfolder (\Datafiles), which contains the original microdata (EstData19802005_AllCounties.dta), the main data set for the reduced form estimations (mobilitywageturnoverincyespreparationlimit99.dta) and the empirical moments values and covariance matrix from the data. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% REDUCED FORM ANALYSIS %%%%%%%%%%%%%%%%%%%%%%%%%%% *************************************** SAS ************************************ To start the data preparation process, run the SAS file "01PrepDataSet" which creates the Stata data set "EstData19802005_AllCounties.dta" which is the basis for all empirical work in the paper. ************************************** Stata *********************************** Run the main master do-file (masterfile.do) which calls the following programs: - datapreparation.do: Constructs a data set from the original microdata including some socio-economic and employment history characteristics. - placebopreparation.do: Constructs data sets that show for each firm in each year the set of workers who used to work in that firm in the previous and post x years but not in the year itself. - matrices.do: Constructs data sets that show for each worker all of his/her actual and placebo coworkers. - massmovementindicator.do: Constructs an indicator for movements of more than one worker from one firm to another between any two subsequent years. - mobilitypreparationpart1.do: Constructs an intermediate data set used in the later regression models. - mobilitypreparationpart2.do: Constructs an intermediate data set used in the later regression models. - mobilitysystematic.do: Randomly allocates movers to firms and calculates exposure measures. - mobilitydescriptives.do: Provides some first descriptive statistics (though not for the final estimation sample). - mobilitywageturnoverpreparation.do: Prepares the data sets used in the main regressions. - mobilitywageturnover.do: Runs all the main regression models (for heterogeneity results, choose the appropriate locals in the command block at the top of the program). - mobilitywageturnoverstayers.do: Runs the regression models that distinguish between the profiles of stayers and the effect due to dynamic selection. - mobilitygraphsconvergence.do: Generates the convergence graphs based on the previous estimation results. - mobilitydescriptivespost.do: Provides descriptive statistics for the final estimation sample. - mobilitywageturnoverVARCOVmatrixlambda.do: Builds on the main regression file (mobilitywageturnover.do) but extracts the variance-covariance matrix of the coefficient estimates of our two main models (which are needed in the structural estimation part). - mobilitywageturnoverpreparationXX.do: Same as mobilitywageturnoverpreparation.do only that now the data is prepared for different maximum network sizes (chosen by setting the local "networklimitquantile" at the beginning of the file to 50, 75, 90 or 95). - mobilitywageturnoverXX.do: Runs robustness checks with respect to the maximum network size allowed (Table C-1). - mobilitywageturnover_additonal.do: Runs robustness checks with respect to different market sizes (Table C-2). Expected computation time: Several days since especially some of the data preparation files (e.g. matrices.do) take a long time to complete. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% STRUCTURAL MODEL %%%%%%%%%%%%%%%%%%%%%%%%%%% Run the main program (main.m). This calls the following programs - Setup.m: Set up exogeneous values. It sets the random number generator to Mersenne Twister using a seed of 1. For estimation we have used both a particle swarm algorithm and a gradient-based approach. These are called in line 67-68 of main.m. The optimizers calls either Quadraticfunction.m or QuadraticfunctionParFor.m. Quadraticfunction.m: Objective function value that calls - Simulation.m: Simulates worker histories - Nleq1.m: Solves reservation values- Moments.m: Calculates moments QuadraticfunctionParFor.m: Objective function value (with parallelizing in the simultion of worker histories). It calls the same set of programs as Quadraticfunction.m. After the estimation/optimal structural parameters are found main.m calls the following programs. Momplot.m: Makes plots of model fit latexTable.m: Used to generate latex output tables Stderr.m: Calculates std. errors CounterFac.m: Calculates the counterfactural scenarioes Expected computation time: This is determined by the number of workers that is simulated in the estimation. With 5 million workers the expected computation time for estimation using 70 cores is around 5-10 days. Without estimation (commenting out lines 67-68) it takes less than 1 hour.