General set up of code: Generally each model has a calibration program (calibrate_hetero.f90) and code to find the optimal tax parameters (optimal_hetero.f90). A grid search is used to find both the calibration parameters and the optimal tax functions. When searching for the calibration parameters or optimal tax parameters the “output for grid search” is used to output the relevant information from each steady state. This output focuses on aggregate economic variables and average decisions by age. In order to further analyze a steady state given a set of calibration and tax parameters the output labeled “output for steady state” should be used. This output provides additional cross-sectional information (such as labor, savings, and consumption). Finally, the Matlab code compile_code_RED.m is used to process the results and prepare the tables and figures for the manuscript. Makefile.f and build.sh are included to help in compilation. In order to compile the code the location of mpif90 needs to be included in the first line of Makefile.f and the path to the libraries needs to be updated for the LFLAGS on line 7. Additionally, all the paths in build.sh need to be updated with the appropriate locations. Once the paths are updated the code can be compiled by typing “./build.sh”. A submit script is included which can be used as a template to launch the code. The code is parallelized and takes advantage of MPI. The code is parallelized across the evaluation of steady states. For example, when calibrating, each slave solves for particular steady states with a combination of calibration parameters and then reports the aggregates for these steady states to the master. Each steady state is determined with a standard dampening procedure: 1. Initial guess on aggregate economic variables are inputted by the user. 2. Given aggregates, the rental rate and wage rate are calculated using the marginal products from the firm. 3. The agent’s value functions are determined (calculated with backward induction). 4. The code simulates the decisions for a number of agents given random draws of idiosyncratic productivity shocks. 5. Calculate updated economic aggregates that are consistent with the agents’ decisions. 6. Check if updated aggregates are close to the guesses (in step 1). If close then stop. Otherwise update guesses with weighted average between the previous guesses and the updated aggregates and return to step 2. Given that each slave does this whole procedure for a given steady state, once the number of processors exceeds the number of tax or calibration parameters being checked there will be no increase in speed from using more processors. The time that the code takes to run depends on the grid sizes for the state variables (for the exogenous model kgridN and the LBD model both kgridN and sgridN), the number of steady states that are being computed, the number of processors, the amount of dampening included in the update step (step 6), and the proximity of the initial guesses. Generally, one iteration of steps 1-6 will take approximately 5 minutes for the exogenous model and 1.5 hours for the LBD model. The software used is the Intel Fortran Compiler, Version 12.1.6 and MVAPICH2 Version 2.2b. The operating system is Scientific Linux Release 5.11 (Boron). Figure 1: Actual data: The labor, earnings, and consumption actual data is created from the PSID as discussed in the paper. The actual savings data is from the SCF and compiled according to the discussion in the paper. Earnings, consumption and savings data is deflated using the GDP deflator and scaled by a factor that is determined such that average earnings in the models match the data. PSID labor data reports hours which is converted to percent of endowment by assuming individuals have 6000 hours available in a year. Exogenous profiles: The raw data for these profiles is created by running the code .\exogenous\benchmark\calibrate\calibrate_hetero.f90 with the output for analyzing the steady state. When solving for just one steady state, Beta1N and chi1N should be set to one. LBD profiles: The raw data for these profiles is created by running the code .\lbd\benchmark\calibrate\calibrate_hetero.f90 with the output for analyzing the steady state. Both phi1_robust and phi2_robust are set to zero. When solving for just one steady state, Beta1N, chi1N, weight1N, weight2N, weight3N, sigma2N, and weight4N should be set to one. This individual profiles that are outputted are included in the Matlab file RED_data_from_models.mat and processed in compiled_code_RED.m to create the figure. Table3, Figure 2, Figure 3 The figures describe the optimal tax policies which are determined using a grid search. Exogenous: The grid search is done using the code .\exogenous\benchmark\optimal\optimal_hetero.f90. The calibration values need to be set to the appropriate values and partial_equilibrium should be set to zero. Once the optimal tax policy is found the model is solved for that specific steady state and additional detail is outputted with the “output for steady state” part of the code. These details are included in the Matlab file RED_data_from_models.mat. This data is processed in compiled_code_RED.m to create Figure 3. LBD: The grid search is done using the code .\lbd\benchmark\optimal\ optimal_hetero.f90. The calibration values need to be set to the appropriate values. In addition, partial_equilibrium, phi1_robust1, and phi2_robust should be set to zero. Note that lambda0_optimizer.f90 should be used and not lambda0_optimizer_wlevel.f90 when compiling the code. Once the optimal tax policy is found the model is solved for that specific steady state and additional detail is outputted with the “output for steady state” part of the code. These details are included in the Matlab file RED_data_from_models.mat. This data is processed in compiled_code_RED.m to create Figure 3. Table 4 The columns represent steady state economies in the LBD model in which the tax policies are varied to mimic certain features of the optimal tax policy solved for in the exogenous model. The steady state for column II is calculated using .\lbd\benchmark\optimal\optimal_hetero.f90 (need to use lambda0_optimizer.f90). The steady states for column III is calculated using .\lbd\benchmark\optimal\optimal_hetero_wlevel.f90 and includes lambda0_optimizer_wlevel.f90 when compiling instead of lambda0_optimizer.f90. The difference between these two programs is that the “wlevel” program clears the government budget constraint by changing both the capital and labor tax rate but holding the ratio of the labor and capital tax rate fixed. In contrast, the benchmark code clears the government budget constraint by changing the labor tax rate. The optimal tax parameters in column IV are determined using a grid search and program.\lbd\benchmark\optimal\optimal_hetero.f90 (need to use lambda0_optimizer.f90) where lambdak is fixed at 30% and the search is only over the labor tax parameters. Once this tax policy is determined, the code is rerun for the specific steady state with the additional information being outputted. All of the relevant information for the steady states are included in the Matlab file RED_data_from_models.mat. The individual decisions for the steady states in columns II-IV are all outputted and the Matlab file calculates the CEVs relative to the steady state with the optimal tax policy. Table 5 All the columns represent steady state economies with sub-optimal tax policies. The steady states in columns I-III are calculated using .\exogenous\benchmark\optimal\optimal_hetero.f90 in which each lambda0, lambda1, and lambdak are increased, respectively. The steady states in columns IV-VI are calculated using .\lbd\benchmark\optimal\optimal_hetero.f90. For each steady state the agent’s profiles are outputted and the relevant information is included in the Matlab file RED_data_from_models.mat. The Matlab file compile_code_RED.m calculates the CEVs relative to the relevant steady state with the optimal tax policy. Table 6 The exogenous baseline is calculated using .\exogenous\benchmark\calibrate\calibrate_hetero.f90 using the relevant calibrated parameters. The exogenous optimal steady state is calculated using .\exogenous\benchmark\optimal\optimal_hetero.f90. The LBD baseline is calculated using .\lbd\benchmark\calibrate\calibrate_hetero.f90. The LBD optimal is calculated using .\lbd\benchmark\optimal\ optimal_hetero.f90. All of the relevant information for the steady states are included in the Matlab file RED_data_from_models.mat. The Matlab file compile_code_RED.m reads in these aggregate economic variables and the agent’s earnings profiles to calculate the percent change from the baseline, the average tax rate, and the marginal tax rates for each steady state. Figure 4 The exogenous baseline is calculated using .\exogenous\benchmark\calibrate\calibrate_hetero.f90 using the relevant calibrated parameters. The LBD baseline is calculated using .\lbd\benchmark\calibrate\calibrate_hetero.f90. The agents’ decisions are outputted and included in RED_data_from_models.mat and then summarized and plotted in the Matlab file compile_code_RED.m. Figure 5 The exogenous baseline is calculated using .\exogenous\benchmark\calibrate\calibrate_hetero.f90 using the relevant calibrated parameters. The exogenous optimal is calculated using .\exogenous\benchmark\optimal\optimal_hetero.f90. The agents’ decisions are outputted and included in RED_data_from_models.mat and then summarized and plotted in the Matlab file compile_code_RED.m. Figure 6 The LBD baseline is calculated using .\LBD\benchmark\calibrate\calibrate_hetero.f90 using the relevant calibrated parameters. The LBD optimal is calculated using .\LBD\benchmark\optimal\optimal_hetero.f90. The agents’ decisions are outputted and included in RED_data_from_models.mat and then summarized and plotted in the Matlab file compile_code_RED.m. Table 7 The table contains the optimal tax policies in three different models which include the labor utility function, as opposed to the benchmark utility function that includes leisure. For column I the exogenous model is calibrated with a grid search using the code .\exogenous\labor\calibrate\calibrate_hetero.f90. Once the calibration parameters are determined they are inputted and the optimal is determined with a grid search using the code .\exogenous\labor\optimal\optimal_hetero.f90. The variable vary_frisch should be set to zero so that the parameter controlling the Frisch elasticity is held constant throughout the life time. Column II is the optimal tax policy in the LBD model. The model is calibrated with a grid search using the code .\lbd\labor\calibrate\calirbate_hetero.f90. Once the calibration parameters are determined they are inputted and the optimal tax policy is determined with a grid search using the code .\lbd\labor\optimal\optimal_yeter.f90. Column III is the optimal tax policy in the exogenous model with the Frisch elasticity parameter varies by age. The model is calibrated with a grid search using the code .\exogenous\labor\calibrate\calibrate_hetero.f90 with the variable vary_frisch set to one. Once the calibration parameters are determined they are inputted and the optimal is determined with a grid search using the code .\exogenous\labor\optimal\optimal_heter.f90 with the variable vary_frisch set to one. Table 8 The results in column I are repeated results from previous tables. Column II is the optimal tax policy in the LBD model with a larger value for phi_1. The model is calibrated with a grid search using the code .\lbd\benchmark\calibrate\calibrate_hetero.f90 with robust_phi1 set equal to 1 (and robust_phi2=0). Once these calibration parameters are calculated, they should be included in the code .\lbd\benchmark\optimal\optimal_hetero.f90 and a grid search is used to find the optimal tax policy. The variable robust_phi1 should be set to 1 (and robust_phi2=0). Column III is the optimal tax policy in the LBD model with a larger value for phi_2. The model is calibrated with a grid search using the code .\lbd\benchmark\calibrate\calibrate_hetero.f90 with robust_phi2 set equal to 1 (and robust_phi1=0). Once these calibration parameters are calculated, they should be included in the code .\lbd\benchmark\optimal\optimal_hetero.f90 and a grid search is used to find the optimal tax policy. The variable robust_phi2 should be set to 1 (and robust_phi1=0). Results in Section 7.3 The welfare effects in the counterfactual partial equilibrium steady states are determined when aggregate capital is held at the levels calculated under the baseline tax policy but aggregate labor is allowed to clear the aggregate constraint (these steady states are calculated under the optimal tax policies solved for in the general equilibrium models). To calculate this partial equilibrium steady state in the exogenous model the code .\exogenous\benchmark\optimal\optimal_hetero.f90 is used and the variable partial_equilibrium is set to 1. The value of K_ig needs to be set to the level of aggregate capital in the baseline since it will not update. The agents’ profiles are outputted. To calculate this partial equilibrium steady state in the LBD model the code .\LBD\benchmark\optimal\optimal_hetero.f90 is used and the variable partial_equilibrium is set to 1. The value of K_ig needs to be set to the level of aggregate capital in the baseline since it will not update. The agents’ profiles are outputted and included in RED_data_from_models.mat. The Matlab file compile_code_RED.m takes the agents’ profiles and computes the CEVs for the welfare gain compared to the respective baseline steady states. Table 9, Figure 7 The figures describe the optimal tax policies which are determined using a grid search under the Gouveia and Straus (1994) tax function. The calibration values are the same as in Table 3, Figure 2 and Figure 3. Exogenous: The grid search is done using the code .\exogenous\benchmark\optimal_gs\optimal_hetero.f90. The calibration values need to be set to the appropriate values and partial_equilibrium should be set to zero. The calibration values are the same as in the benchmark experiment. Once the optimal tax policy is found the model is solved for that specific steady state and additional detail is outputted with the “output for steady state” part of the code. These details are included in RED_data_from_models.mat. This data is processed in compiled_code_RED.m. LBD: The grid search is done using the code .\lbd\benchmark\optimal_gs\ optimal_hetero.f90. The calibration values need to be set to the appropriate values and partial_equilibrium, phi1_robust1, and phi2_robust should be set to zero. Note that Lambda0_optimizer.f90 should be used and not lambda0_optimizer_wlevel.f90 when compiling the code. The calibration values are the same as in the benchmark experiment. Once the optimal tax policy is found the model is solved for that specific steady state and additional detail is outputted with the “output for steady state” part of the code. These details are included in RED_data_from_models.mat. This data is processed in compiled_code_RED.m.