Alexei Onatski and Francisco Ruge-Murcia, "Factor Analysis of a Large DSGE Model", Journal of Applied Econometrics, Vol. 28, No. 6, 2013, pp. 903-928. All the programs and other files are ASCII files in DOS format. They are zipped in the file or-files.zip. Unix/Linux users should use "unzip -a". Our artificial data were generated by data_generator.m. The outcome of this routine is a 156 by 120 matrix of data, called DATA. The rows of this matrix correspond to different variables and the columns correspond to different time periods. The order of the variables is as follows: rows 1-30: (% deviation from the steady state value of) sectoral outputs rows 31-60: sectoral hours rows 61-90: sectoral wages rows 91-120: sectoral consumptions row 121: aggregate hours row 122: aggregate consumption row 123:interest rate row 124: aggregate output row 125: money growth rows 126-155: sectoral inflations row 156: aggregate inflation %%%%%% The state-space model (1) was obtained by abcd_minimal.m. The outcome of the routine is a set of four matrices AAAA,BBBB,CCCC, and DDDD, corresponding to A,B,C, and D in (1). Matrices AAA,BBB,CCC,DDD which also appea in the routine correspond to a valid, but not minimal state-space representation of (1). The order of the innovations in the vector epsilon_t is as follows: first 30 components are sectoral productivity innovations (in the order described in the Appendix A of the paper), the 31-th component in the innovation to the monetary policy shock, the 32-nd component is the innovation to the money demand shock, and the last component is the innovation to the labor supply shock. (Note that this order is different from that described in the paper, where the first three components coorespond to the innovations to the economy-wide shocks). %%%%%% Figure 1 was generated by pervas.m. To run pervas.m, run abcd_minima.m first, so that necessary input in pervas.m is generated. The latter comment is also true for most of the codes listed below. %%%%%% Figure 2 was generated by band_pervasiveness.m. Computations in band_pervasiveness use the values of the transfer function of the state space system (1), which are obtained by transfer_comp.m. So, first, run transfer_comp.m. %%%%%% Figure 3 was generated by figure3gen.m. Don't forget to change the X and Y scales into log mode. %%%%%% Figure 4 was generated by dynamicPCcontent.m. Change X-scale to log mode. %%%%%% The code for the computation at the end of Section 3 is future_past1.m %%%%%% Figures 5,6 and 7 were generated by finite_lag.m. For Figure 5, set z=33 on line 4 of finite_lag.m. For Figure 6, set z=31, for Figure 7, set z=32. %%%%%% The calculations of the five non-zero eigenvalues of Psi*E(FF')*Psi' and of the largest eigenvalue of E(eta*eta') are done by static_eigenvalues.m %%%%%% The proportions reported in footnote 10 and in the paragraph where the footnote is introduced are computed by PCprojection_on_shock.m. %%%%%% Figure 8 was generated by ratios_static.m. Plot variable ratios obtained by running this code. %%%%%% Bai and Ng criterion for determining the number of dynamic factors is implemented in BN_criterion_Francisco.m. Hallin and Liska criterion is implemented in Hallin_Liska_criterion_Francisco.m %%%%%% Relative forecasting power of various predictors reported in the beginning of Section 6 was computed by optimal_all_new.m. For example, to find the percentage of the forecastable variance that can be captured by the forecast of output growth based on its own history and the history of aggregate inflation we compute 100*(1-V2outd(1,1))/(1-V1outd). %%%%%% Table 2 was generated using the outcome of optimal_all.m. Precisely, the raw 90.8%, 79.8% was obtained by computing (voutd-V1out-(suf1out(1,1)/40000-(suf2out(1)/40000)^2))/(voutd-V1out) and (vinf-V1inf-(suf1inf(1,1)/40000-(suf2inf(1)/40000)^2))/(vinf-V1inf). The next raw, was obtained from (voutd-V1out-[1 1 0]*(suf1out/40000-(suf2out/40000)*(suf2out/40000)')*[1;1;0])/(voutd-V1out) and (vinf-V1inf-[1 1 0]*(suf1inf/40000-(suf2inf/40000)*(suf2inf/40000)')*[1;1;0])/(vinf-V1inf). The last raw was obtained by computing (voutd-V1out-ones(1,3)*(suf1out/40000-(suf2out/40000)*(suf2out/40000)')*ones(3,1))/(voutd-V1out) and (vinf-V1inf-ones(1,3)*(suf1inf/40000-(suf2inf/40000)*(suf2inf/40000)')*ones(3,1))/(vinf-V1inf). %%%%%% To generate Figures 9-13, first run impulse_theoretical.m and impulse_mc.m (before running impulse_theoretical.m, clear the memory). Then, run plot_agr_impulse.m, which generates Figure 9, plot_sec_impulse_con.m, which generates Figure 10, plot_sec_impulse_inf.m, which generates Figure 11, plot_sec_impulse_out.m, which generates Figure 12, and plot_sec_impulse_hou.m, which generates Figure 13. %%%%%% The entries of the row of Table 3 corresponding to 5 factors were obtained by running sectoral_comparison.m. Before running sectoral_comparison.m, we run impulse_theoretical.m, impulse_mc.m and impulse_mc1.m. The rest of the rows of Table 3 require running modifications of impulse_mc.m. For example, to obtain row corresponding to two factors, change line 7 of impulse_mc.m into nfactors=2, re-run the so modified impulse_mc.m, and run sectoral_comparison.m. For row corresponding to three factors, line 7 in impulse_mc.m should say nfactors=3, and so on.