Debian Codegraph @

tests/ecb/backward-models/irf/solow_2.mod

raw
1 close all
2
3 var Efficiency $A$
4 EfficiencyGrowth $X$
5 Population $L$
6 PopulationGrowth $N$
7 Output $Y$
8 PhysicalCapitalStock $K$ ;
9
10 varexo e_x $\varepsilon_x$
11 e_n $\varepsilon_n$;
12
13 parameters alpha $\alpha$
14 delta $\delta$
15 s $s$
16 rho_x $\rho_x$
17 rho_n $\rho_n$
18 EfficiencyGrowth_ss $X^{\star}$
19 PopulationGrowth_ss $N^{\star}$ ;
20
21 alpha = .33;
22 delta = .02;
23 s = .20;
24 rho_x = .90;
25 rho_n = .95;
26 EfficiencyGrowth_ss = 1.0;
27 PopulationGrowth_ss = 1.0;
28
29 model;
30 Efficiency = EfficiencyGrowth*Efficiency(-1);
31 EfficiencyGrowth/EfficiencyGrowth_ss = (EfficiencyGrowth(-1)/EfficiencyGrowth_ss)^(rho_x)*exp(e_x);
32 Population = PopulationGrowth*Population(-1);
33 PopulationGrowth/PopulationGrowth_ss = (PopulationGrowth(-1)/PopulationGrowth_ss)^(rho_n)*exp(e_n);
34 Output = PhysicalCapitalStock(-1)^alpha*(Efficiency*Population)^(1-alpha);
35 PhysicalCapitalStock = (1-delta)*PhysicalCapitalStock(-1) + s*Output;
36 end;
37
38
39 shocks;
40 var e_x = 0.005;
41 var e_n = 0.001;
42 end;
43
44 histval;
45 Efficiency(0) = 1;
46 EfficiencyGrowth(0) = .5;
47 Population(0) = 1;
48 PopulationGrowth(0) = .5;
49 PhysicalCapitalStock(0) = 1;
50 end;
51
52
53 /*
54 ** First approach: Use the covariance matrix to define the impulses.
55 */
56
57 // Define the shocks for which we want to compute the IRFs
58 listofshocks = {'e_x', 'e_n'};
59
60 // Define the variables for which we want to compute the IRFs
61 listofvariables = {'Efficiency', 'Population', 'Output'};
62
63 // Compute the IRFs
64 irfs1 = backward_model_irf([], dseries(), listofshocks, listofvariables, 50);
65
66 /*
67 ** Second approach: Explicitely comunnicate the paths for the exogneous variables.
68 */
69
70 x0 = zeros(50,2);
71 x0_1 = x0;
72 x0_2 = x0;
73 x0_1(1,1) = sqrt(M_.Sigma_e(1,1));
74 x0_2(1,2) = sqrt(M_.Sigma_e(2,2));
75
76 simshocks = {dseries(x0_1, 2, M_.exo_names), dseries(x0_2, 2, M_.exo_names) };
77
78 // Compute the IRFs
79 irfs2 = backward_model_irf([], dseries(), simshocks, listofvariables, 50);
80
81 /*
82 ** Check that the two approaches do provide the same results.
83 */
84
85 verbatim;
86 if max(abs(irfs1.e_x.Efficiency.data-irfs2.experiment_1.Efficiency.data))>1e-12
87 error('There is something wrong in the IRFs.')
88 end
89 if max(abs(irfs1.e_x.Output.data-irfs2.experiment_1.Output.data))>1e-12
90 error('There is something wrong in the IRFs.')
91 end
92 end;