Debian Codegraph @

tests/identification/rbc_ident/rbc_ident_varexo_only.mod

raw
1 % Real Business Cycle Model
2 % Created by Johannes Pfeifer (@JohannesPfeifer, [email protected])
3 % =========================================================================
4 % Copyright © 2015-2020 Dynare Team
5 %
6 % This file is part of Dynare.
7 %
8 % Dynare is free software: you can redistribute it and/or modify
9 % it under the terms of the GNU General Public License as published by
10 % the Free Software Foundation, either version 3 of the License, or
11 % (at your option) any later version.
12 %
13 % Dynare is distributed in the hope that it will be useful,
14 % but WITHOUT ANY WARRANTY; without even the implied warranty of
15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 % GNU General Public License for more details.
17 %
18 % You should have received a copy of the GNU General Public License
19 % along with Dynare. If not, see <https://www.gnu.org/licenses/>.
20 % =========================================================================
21
22 close all;
23
24 %----------------------------------------------------------------
25 % 1. Defining variables
26 %----------------------------------------------------------------
27
28 var y c k l x z g ysim xsim;
29
30 varexo eps_z eps_g;
31 parameters gn gz betta delta psi sigma theta rho_z sig_z rho_g sig_g q12 zbar gbar;
32
33
34 %----------------------------------------------------------------
35 % 2. Calibration
36 %----------------------------------------------------------------
37
38 gn = 0.00243918275778010;
39 gz = 0.00499789993972673;
40 betta = 0.9722^(1/4)/(1+gz);
41 delta = 1-(1-0.0464)^(1/4);
42 psi = 2.24;
43 sigma = 1.000001;
44 theta = 0.35;
45
46 zbar = 0.0023;
47 gbar = -0.0382;
48
49 rho_z = 0.8;
50 sig_z = 0.0086;
51 rho_g = 0.8;
52 sig_g = 0.0248;
53
54 q12 = -0.0002;
55
56
57
58 %----------------------------------------------------------------
59 % 3. Model
60 %----------------------------------------------------------------
61
62
63 model;
64 % Intratemporal Optimality Condition
65 (psi*c)/(1-l) = (1-theta)*(k(-1)^theta)*(l^(-theta))*(exp(z)^(1-theta));
66 % Intertemporal Optimality Condition
67 (c^(-sigma))*((1-l)^(psi*(1-sigma))) = betta*((c(+1))^(-sigma))*((1-l(+1))^(psi*(1-sigma)))*(theta*(k^(theta-1))*((exp(z(+1))*l(+1))^(1-theta))+(1-delta));
68 % Aggregate Resource Constraint
69 y = c + exp(g) + x;
70 % Capital Accumulation Law
71 (1+gz)*(1+gn)*k = (1-delta)*k(-1) + x;
72 % Production Function
73 y = (k(-1)^theta)*((exp(z)*l)^(1-theta));
74
75 % Stochastic Processes
76 z = zbar + rho_z*z(-1) + eps_z;
77 g = gbar + rho_g*g(-1) + eps_g;
78
79 ysim = y;
80 xsim = x;
81
82 end;
83
84
85 %----------------------------------------------------------------
86 % 4. Computation
87 %----------------------------------------------------------------
88
89
90 shocks;
91 var eps_z ; stderr sig_z;
92 var eps_g ; stderr sig_g;
93 end;
94
95
96 initval;
97 z = 0;
98 k = (betta*theta)^(1/(1-theta))*exp(zbar/(1-rho_z));
99 c = (1-betta*theta)/(betta*theta)*k;
100 y = exp(zbar/(1-rho_z))^(1-theta)*k^theta;
101 l = k/(((1-betta*(1-delta))/(betta*theta*(exp(zbar/(1-rho_z))^(1-theta))))^(1/(theta-1)));
102 end;
103
104
105 estimated_params;
106 stderr eps_z, 0.0001, 0,10;
107 stderr eps_g, 0.0001, 0,10;
108 % betta, 0.9,0,1;
109 %corr eps_z, eps_g, 0.0001, -1,1;
110 end;
111
112 varobs ysim xsim;
113
114 identification(advanced=1);
115 temp=load([M_.dname filesep 'identification' filesep M_.fname '_ML_Starting_value_identif'])
116 temp_comparison=load(['rbc_ident_std_as_structural_par' filesep 'identification' filesep 'rbc_ident_std_as_structural_par' '_ML_Starting_value_identif'])
117
118 if max(abs(temp.ide_hess_point.ide_strength_dMOMENTS - temp_comparison.ide_hess_point.ide_strength_dMOMENTS))>1e-8 ||...
119 max(abs(temp.ide_hess_point.deltaM - temp_comparison.ide_hess_point.deltaM))>1e-8 ||...
120 max(abs(temp.ide_moments_point.MOMENTS- temp_comparison.ide_moments_point.MOMENTS))>1e-8 ||...
121 max(abs(temp.ide_moments_point.MOMENTS- temp_comparison.ide_moments_point.MOMENTS))>1e-8
122 error('Results do not match')
123
124 end