Computation codes and data for "The Welfare and Distributional Effects of Fiscal Volatility: a Quantitative Evaluation," by Ruediger Bachmann, Jinhui Bai, Minjoon Lee, and Fudong Zhang. March 20, 2020 Software used: 64 bit MATLAB version 8 (R2012b) or later, with the usage of CMEX interface and the following toolboxes: Curve Fitting, Optimization, Parallel Computing, Statistics. The CMEX files are compiled on 64 bit Linux and Windows operation systems with the Intel C++ 2013 Compiler with Math Kernel Library. Operating system used: 64 bit Linux Workstations running on a Linux Cluster. However, the program should also run on 64 bit MS Windows. Hardware used: The computation codes involve value function iterations with large state spaces and large scale simulations. To run the codes for the baseline model, the system (local workstation or computer cluster) needs to have access to a minimum of 12 CPU cores, 6 GB RAM per core, and 15 GB of free storage space. For the system requirements to run the codes for the alternative specifications, see Section 2 below. 1. Baseline model To run the baseline model, copy all the files in the "Model\CommonFiles" folder to the "Model\Baseline" folder and make sure that Matlab has access to all the files in "Model\Baseline". The programs should be run in the following order. 1) Replicating the two-shock equilibrium Run job_sub_2s.m (Computation time: Less than an hour.). This will call the main code (main_2s_gini_Tau1.m) as well as the subcodes that execute VFIs (svf2s_gini_Tau1.m) and simulations (sim2s_gini_Tau1.m). It will also load input_2s1s.mat. The simulation subcode (sim2s_gini_Tau1.m) uses random numbers. The seeds are specified in lines 34, 44, 96, 106, 114, and 124. To try different random numbers, change the seeds in the command to any number. A subcode "markovbewley.m" will receive these seeds and generate random numbers using the Matlab v5 generator. This will generate the following four types of files: i) The final result file that only contains all the key results such as laws of motions and value functions (result_2s_gini_final_Tau1.mat). ii) An intermediate result file that contains more information, which is needed to create some figures and tables (result_2s_gini_med_Tau1.mat). iii) A text file (output_2s_gini_Tau1.txt) that summarizes the characteristics of the equilibrium and reports the wealth distribution in Table 3. iv) A text file (VFI_report.txt) that reports the intermediate results from the value function iteration step, and 12 text files (main_2s_gini_Tau1_worker_X.txt) give intermediate statistics from the parallel simulation step. 2) Analyzing the two-shock equilibrium Run Table2.m to replicate Table 2 (Computation time: Less than a minute.). It will need result_2s_gini_med_Tau1.mat generated under 1). Run Table4.m to replicate Table 4 (Computation time: Less than a minute.). It will need result_2s_gini_med_Tau1.mat generated under 1). 3) Replicating the one-shock equilibrium Run job_sub_1s.m (Computation time: Less than an hour.). This will call the main code (main_1s_gini_Tau1.m) as well as the subcodes that executes VFIs (svf1s_gini_Tau1.m) and simulations (sim1s_gini_Tau1.m). It will also load input_2s1s.mat. The simulation subcode (sim1s_gini_Tau1.m) uses random numbers. The seeds are specified in lines 35, 46, 92, 102, 110, and 120. To try different random numbers, change the seeds in the command to any number. A subcode "markovbewley.m" will receive these seeds and generate random numbers using the Matlab v5 generator. This will generate the following three types of files: i) The final result file that only contains all the key results such as laws of motions and value functions (result_1s_gini_final_Tau1.mat). ii) A text file (output_1s_gini_Tau1.txt) that summarizes the characteristics of the equilibrium. iii) A text file (VFI_report.txt) that reports the intermediate results from the value function iteration step, and 12 text files (main_1s_gini_Tau1_worker_X.txt) give intermediate statistics from the parallel simulation step. 4) Replicating the transition-path calculation Calculation of the transition-path is conditional on the initial value of G (G_l, G_m, and G_h). To calculate the transition-path equilibrium path conditional on G_1 = G_l, run job_sub_G1.m. (Computation time: About 6 hours.) To calculate the transition-path equilibrium path conditional on G_1 = G_m, run job_sub_G2.m. (Computation time: About 6 hours.) To calculate the transition-path equilibrium path conditional on G_1 = G_h, run job_sub_G3.m. (Computation time: About 6 hours.) job_sub_GX.m will call the main code (main_trans_Gini_GX_4/8000_Tau1.m) as well as the subcodes that executes simulations (sim_trans_seg_Gini_Tau1.m). All these files load input_trans.mat as well as result_1s_gini_final_Tau1.mat (generated under 3)). The simulation subcode (sim_trans_seg_Gini_Tau1.m) uses random numbers. The seeds are specified in lines 80 and 88. To try different random numbers, change the seeds in the command to any number. A subcode "markovbewley.m" will receive these seeds and generate random numbers using the Matlab v5 generator. job_sub_GX.m will generate the following files: i) dist_Gini_GX_4/8000_Tau1.mat that contains the joint distributions generated from the stochastic steady-state of the two-shock equilibrium, as an initial input of the simulations. ii) result_transGX_Gini_8/4000_Tau1.mat that contains the key results such as laws of motions and value functions. iii) Four sets of text files that report the intermediate results from the distribution sample collection (data_collection_report.txt), household decision making (ValueF_report.txt), parallel simulations (main_trans_Gini_GX_X000_Tau1_worker_X.txt), and equilibrium iteration (output_transGX_Gini_X000_med_Tau1.txt). iv) For the G2 case, a file (Policy_1p.mat) that contains the policy function from the first period after elimination of the fiscal volatility, which is needed to replicate Figure 1. 5) Calculation of the welfare gains To calculate the welfare gains from eliminating fiscal volatilities conditional on G_1 = G_l, run Welfare_Gini_16000_G1.m. (Computation time: About 10 minutes.) To calculate the welfare gains from eliminating fiscal volatilities conditional on G_1 = G_m, run Welfare_Gini_16000_G2.m. (Computation time: About 20 minutes.) To calculate the welfare gains from eliminating fiscal volatilities conditional on G_1 = G_h, run Welfare_Gini_16000_G3.m. (Computation time: About 10 minutes.) Each of these will load three files from the previous steps: result_2s_gini_final_Tau1.mat (generated under 1)), result_transGX_Gini_8/4000_Tau1.mat (generated under 4)), and dist_Gini_GX_4/8000_Tau1.mat (generated under 4)). Three output data files (Welfare_Gini_GX_X000_Tau1.mat) and 3 Latex tables (gainC_GX_Gini_Tau1.tex) contain the welfare data reported in Table 7. To generate Tables 5 and 6, after calculating the welfare gains conditional on initial G, run Table5_6.m. (Computation time: Less than a minute.) This will load the data files generated in the previous step (result_TransGX_Gini_8/4000_Tau1.mat). This will generate the Latex tables (gain_all_Tau1.tex, gainC_all_Tau1.tex) containing information to replicate Table 5 and 6, respectively. 6) Additional comparisons between 2s- and transition-path equilibria Note: If you use a Linux environment, please use the interactive mode instead of submitting to a job scheduler. The latter may run into errors when creating and saving figures. Run Figure1.m to generate the files for Figure 1 (fig1_policy_comp_tau1.fig and fig1_policy_comp_tau1.png). (Computation time: Less than a second.) Note that it will need to load result_2s_gini_med_Tau1.mat generated under 1) as well as Policy_1p.mat generated under 4). To replicate the comparisons of aggregate capital paths between the two equilibria, first run LOMcomparison_G1.m, LOMcomparison_G2.m, and LOMcomparison_G3.m. (Computation time: About 1 minute for each.) LOMcomparison_GX.m will load the following four files: input_trans.mat, result_2s_gini_final_Tau1.mat (generated under 1)), dist_Gini_GX_8/4000_Tau1.mat (generated under 4)), and result_transGX_Gini_8/4000_Tau1.mat (generated under 4)). These will generate AGG_Tau1_G1.mat, AGG_Tau1_G2.mat, and AGG_Tau1_G3.mat, which contain the simulated paths of aggregate variables from both the 2s- and the transition-path equilibria. Then run Figure2_3.m that generates both Figures 2 (fig2_kpath_dif_tau1.fig and fig2_kpath_dif_tau1.png) and Figure 3 (fig3_kpath_dif_tau1_cond.fig and fig3_kpath_dif_tau1_cond.png) out of the simulated aggregates. (Computation time: Less than a second.) 2. Alternative Specifications Our paper has 17 alternative specifications. You can find the codes that calculate the two-shock equilibrium for each specification in the corresponding folder under "AlternativeSpecifications" (except for the "sudden change" case that uses the same two-shock equilibrium as in the baseline). Each subfolder is named following the names used in Table 8. To calculate each equilibrium, run job_sub_2s.m in each subfolder. Make sure that you also copy all the files in "Model\CommonFiles" to the folder where you run the job. System requirements: To run the codes for these alternative apecifications, the system (local workstation or computer cluster) needs to have access to a minimum of 12 CPU cores, 6 GB RAM per core, and 1 GB of free storage space. For the Superstar Income case and the Richer Income Process case, the RAM requirement is higher (a minimum of 8 GB RAM per core for the former and a minimum of 16 GB RAM per core for the latter) while the number of the CPU cores and the storage space required are the same as the other cases. Computation time: It will take longer than calculating the two-shock equilibrium in the baseline case because to limit the size of necessary input files we make the VFI start from a degenerate value function. All the cases except for the Richer Income Process case would converge within approximately 12 hours. The Richer Income Process would take approximately two days. 3. Empirical analyses BBLZ_Data.xlsx has the empirical data used. Data needed for each table are in separate tabs. "Table 2" and "Table 4" tabs calculate the moments reported in the corresponding table and present the detrended time-series data used as inputs as well as the raw time-series data. "Appendix A1" tab has the time-series needed to estimate the government purchases process. "Appendix_A1.m" loads the data, estimates the AR(1) process, and approximates the process with a three-state Markov process using the Rouwenhorst method. "Appendix A2" tab has the time-series needed to estimate the rule detailed in Appendix A2. "Appendix_A2.m" loads the data, estimates the OLS regression at both the federal and the state-and-local levels, and reports the coefficients and the standard errors in Table 10. "Appendix A3" tab has the time-series data needed to calibrate the consumption tax rate and the linear-part of the income tax as detailed in Appendix A3. It estimates the two equations reported in Appendix A3 using the time series.