The folders “..\Sectoral_KL”, “..\Firm_KL”, and “..\EconWide_KL” contain the Matlab codes to solve the models in Carvalho and Nechio (2016). In particular: - “..\Sectoral_KL” contains the codes to solve the version of the model with sector- specific factor markets presented in Section 2.1. - “..\Firm_KL” contains the codes to solve the version of the model with firm- specific factor markets presented in Section 2.2. - “..\EconWide_KL” contains the codes to solve the version of the model with economy-wide factor markets presented in Section 2.3. Solving the models: - Main_code.m solves the models that assume a path for nominal aggregate demand and produces the impulse response functions of Figure 1. - Main_code_TR.m solves the models that assume monetary policy follows a Taylor rule and produces the impulse response functions of Figure 2. - The codes Main_code.m and Main_code_TR.m solve the model using Chris Sims’ Gensys algorithm, whose files are contained in folder “..\Gensys”. For the benchmark cases with 67-sector economies, the two codes also simulate data for output and investment and tests for the calibration of the investment cost adjustment parameter (kappa). - The models can be solved for 67-sector economies. As inputs, they require the file “falpha.csv”, which contains the distribution of price stickiness for the 67-sector economy (the order of the columns is: sectoral weight, sectoral frequency of price changes). This file is loaded by Main_code and Main_code_TR.m in order to solve the model. It should not be altered. The calculation that yields the distribution, based on the statistics from Nakamura and Steinsson (2008), is in the Excel file “DataFiveFactsPaper_AggregELI.xls”, available in the folder “..\DataFiles”. - Models with economy-wide factor markets (in folder “..\EconWide _KL”) should take around 7 seconds to run. Models with sector-specific factor markets (in folder “..\Sectoral_KL”) should take around 96 seconds to run. Models with firm- specific factor markets (in folder “..\Firm_KL”) should take around 529 seconds to run. - All codes were written using Matlab 12a. Other files/functions in the folders: - The files Het_Open_mats_1.mat, Het_Open_mats_3.mat and Het_Open_mats_67.mat in each of the three folders (“..\Sectoral_KL”, “..\Firm_KL”, and “..\EconWide_KL”) contain the matrices required for the solution of the models that assume a path for nominal aggregate demand. The matrices correspond to the models with one-sector, 3-sector and 67-sector economies, respectively. They should not be altered. - The file Het_Open_mats_TR_67.mat in each of the three folders (“..\Sectoral_KL”, “..\Firm_KL”, and “..\EconWide_KL”) contains the matrix required for the solution of the model that assume a Taylor rule. The matrix correspond to the models with 67-sector economies. They should not be altered. - The folders “..\Sectoral_KL”, “..\Firm_KL”, and “..\EconWide_KL” also include the code “hptrend.m” which runs an Hodrick–Prescott filter on the model simulated data to test for the calibration of the investment cost adjustment parameter (kappa). The parameter kappa specified in the codes Main_code.m and Main_code_TR.m is already calibrated to match the standard deviation of investment in the data relative to the standard deviation of GDP when the number of sectors equal 67. The codes also run for other choices for kappa, but the relative standard deviation will not match the empirical evidence. - The folder “..\Firm_KL” also contains the files “MainSolveCapital.m”, “ConditionsWoodford.m” and “ConditionsWoodford_noconstraint.m”, which are used to numerically obtain the Phillips curve coefficients in the firm-specific model. This minimization problem also requires minimization codes from Chris Sims contained in the folder “..\Optimize”, and the Matlab toolbox contained in the folder “..\compecon”. Replicating the paper figures: - To replicate Figure 1, run Main_code.m from “..\EconWide_KL”, “..\Sectoral_KL”, and “..\Firm_KL”, in this order. - To replicate Figure 2, run Main_code_TR.m from “..\EconWide_KL”, “..\Sectoral_KL”, and “..\Firm_KL”, in this order. - To replicate Appendix Figure A1, in Main_code.m from “..\EconWide_KL”, “..\Sectoral_KL”, and “..\Firm_KL” set return to labor equal to one (chi=1), and run the codes for 67-sector and one-sector economies. The figure plots the variable called “kappa_tilde”. The model solution with one-sector economies uses Het_Open_mats_1.mat as input. All versions use falpha.csv as input. - To replicate Appendix Figure A2, run Main_code.m from “..\EconWide_KL”, “..\Sectoral_KL”, and “..\Firm_KL” with return to labor equal to 2/3 (chi=2/3), with 67-sector economies. The figure plots the variable called “kappa_tilde”. - To replicate Appendix Figure A3, run Main_code.m from “..\EconWide_KL”, “..\Sectoral_KL”, and “..\Firm_KL” for the 3-sector hypothetical economies with flexible and sticky price distributions. The flexible economies use as input falpha_flex.csv, while the sticky economies use as input falpha_sticky.csv. The panels in the figure plot the variable called “GDPt”.