Debian Codegraph @

tests/identification/kim/kim2.mod

raw
1 % Created by Marco Ratto (@rattoma, [email protected])
2 % based on Kim, Jinill, 2003. "Functional equivalence between intertemporal and
3 % multisectoral investment adjustment costs," Journal of Economic Dynamics
4 % and Control, 27(4), pages 533-549.
5 % =========================================================================
6 % Copyright © 2010-2020 Dynare Team
7 %
8 % This file is part of Dynare.
9 %
10 % Dynare is free software: you can redistribute it and/or modify
11 % it under the terms of the GNU General Public License as published by
12 % the Free Software Foundation, either version 3 of the License, or
13 % (at your option) any later version.
14 %
15 % Dynare is distributed in the hope that it will be useful,
16 % but WITHOUT ANY WARRANTY; without even the implied warranty of
17 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 % GNU General Public License for more details.
19 %
20 % You should have received a copy of the GNU General Public License
21 % along with Dynare. If not, see <https://www.gnu.org/licenses/>.
22 % =========================================================================
23
24 var c k i a lam;
25 varexo ea;
26
27 parameters
28 alph
29 betae
30 delta
31 as
32 s
33 theta
34 phi
35 dumpy
36 ;
37
38
39 alph=0.6;
40 betae=0.99;
41 delta=0.0125;
42 as=0.1;
43 phi=2;
44 s=betae*delta*alph/(1-betae+delta*betae);
45 theta=1;
46
47 model;
48 //(1-(betae*delta*alph/(1-betae+delta*betae)))^theta/c^(1+theta)/(1+theta)*(1+theta)*(i/(betae*delta*alph/(1-betae+delta*betae)))^theta*(i/k/delta)^phi=betae*(1-(betae*delta*alph/(1-betae+delta*betae)))^theta/c(+1)^(1+theta)/(1+theta)*(alph*(1+theta)*a(+1)^(1+theta)*k^(alph*(1+theta)-1)+(1-delta)*(i(+1)/k/delta)^phi*(1+theta)*(i(+1)/(betae*delta*alph/(1-betae+delta*betae)))^theta);
49 lam*(1+theta)*(i/(betae*delta*alph/(1-betae+delta*betae)))^theta*(i/k/delta)^phi=betae*lam(+1)*(alph*(1+theta)*a(+1)^(1+theta)*k^(alph*(1+theta)-1)+(1-delta)*(i(+1)/k/delta)^phi*(1+theta)*(i(+1)/(betae*delta*alph/(1-betae+delta*betae)))^theta);
50 k=(delta*(i/delta)^(1-phi)+(1-delta)*k(-1)^(1-phi))^(1/(1-phi));
51 ((1-(betae*delta*alph/(1-betae+delta*betae)))*(c/(1-(betae*delta*alph/(1-betae+delta*betae))))^(1+theta) +
52 (betae*delta*alph/(1-betae+delta*betae))*(i/(betae*delta*alph/(1-betae+delta*betae)))^(1+theta))^(1/(1+theta))=
53 (a*k(-1)^alph);
54 a = as+ea;
55 lam = (1-(betae*delta*alph/(1-betae+delta*betae)))^theta/c^(1+theta)/(1+theta);
56 //cobs = c+ec;
57 end;
58
59 steady_state_model;
60 s=betae*delta*alph/(1-betae+delta*betae);
61 a=as; %as^((1-alph)/(1+theta))*(delta^((phi+theta+1)/(theta+1))/s)^alph;
62 k=(delta/s/a)^(1/(alph-1));
63 i=delta*k;
64 c=(((a*k^alph)^(1+theta)-s*(i/s)^(1+theta))/(1-s))^(1/(1+theta))*(1-s);
65 lam = (1-s)^theta/c^(1+theta)/(1+theta);
66 end;
67
68 steady;
69 check;
70
71 shocks;
72 var ea = 1;
73 //var ec = 0;
74 end;
75
76 estimated_params;
77 alph ,uniform_pdf, , ,0.5,0.7;
78 //betae ,uniform_pdf,0.99,0.004,0.98,1;
79 //delta ,uniform_pdf,0.0125,0.001,0.01,0.015;
80 phi ,uniform_pdf, , ,0,10;
81 theta ,uniform_pdf, , ,0,10;
82 dumpy ,uniform_pdf, , ,0,10;
83 end;
84
85 varobs c i;
86
87 identification(advanced=1,max_dim_cova_group=3,tol_rank=1e-8);
88 //varobs c i lam; //to check if observing lam identifies phi and theta
89 //identification(ar=1,advanced=1,max_dim_cova_group=3,prior_mc=250);
90 //identification(prior_mc=100);
91
92 % Unit test for analytic_derivation_mode
93 load('kim2/identification/kim2_prior_mean_identif.mat','store_options_ident')
94 if store_options_ident.analytic_derivation~=1 && store_options_ident.analytic_derivation_mode~=-2
95 error('the steady state file changed parameters and we should switch to numerical derivatives for the steady state, i.e. analytic_derivation_mode=-2')
96 end
97
98 % Unit test for correct identification results
99 load('kim2/identification/kim2_prior_mean_identif.mat','ide_moments_point', 'ide_spectrum_point', 'ide_minimal_point', 'ide_reducedform_point')
100 pause(1);
101 chk.ind0 = [1 1 1 0];
102 chk.indno = [0 0 0 1; 0 1 1 0];
103 chk.jweak = [0 1 1 0];
104 chk.jweak_pair = [0 0 0 0 1 0 0 0 0 0];
105 for strVars = {'ind0' 'indno' 'jweak' 'jweak_pair'}
106 if ~isequal(ide_moments_point.(strVars{:}) , chk.(strVars{:}))
107 disp('dMoments:')
108 disp(ide_moments_point.dMOMENTS);
109 disp(strVars{:})
110 disp(ide_moments_point.(strVars{:}));
111 error('identification based on moments is wrong for %s',strVars{:})
112 end
113 if ~isequal(ide_spectrum_point.(strVars{:}) , chk.(strVars{:}))
114 disp('dSPECTRUM');
115 disp(ide_spectrum_point.dSPECTRUM);
116 disp(strVars{:})
117 disp(ide_spectrum_point.(strVars{:}));
118 error('identification based on spectrum is wrong for %s',strVars{:})
119 end
120 if ~isequal(ide_minimal_point.(strVars{:}) , chk.(strVars{:}))
121 disp('dMINIMAL')
122 disp(ide_minimal_point.dMINIMAL);
123 disp(strVars{:})
124 disp(ide_minimal_point.(strVars{:}));
125 error('identification based on minimal system is wrong for %s',strVars{:})
126 end
127 end
128
129 % Integration test if identification works without priors
130 estim_params_=[];
131 dumpy=0;
132 identification(advanced=1,max_dim_cova_group=3);