dsge_base2.mod 6.09 KB
Newer Older
1
// DGP
2
@#ifndef RISKY_CALIBRATION
3
    @#define RISKY_CALIBRATION = 1
4
5
@#endif
@#ifndef EXTREME_CALIBRATION
6
    @#define EXTREME_CALIBRATION = 0
7
8
@#endif
@#ifndef BENCHMARK_CALIBRATION
9
    @#define BENCHMARK_CALIBRATION = 0
10
@#endif
11
12

// ALGORITHM
13
@#ifndef LINEAR_KALMAN
14
    @#define LINEAR_KALMAN = 0
15
16
@#endif
@#ifndef NON_LINEAR_KALMAN
17
    @#define NON_LINEAR_KALMAN = 1
18
19
@#endif
@#ifndef ALGO_SIR
20
    @#define ALGO_SIR = 0
21
22
@#endif
@#ifndef ALGO_SISmoothR
23
    @#define ALGO_SISmoothR = 0
24
25
@#endif
@#ifndef ALGO_APF
26
    @#define ALGO_APF = 0
27
@#endif
28
@#ifndef ALGO_CPF
29
    @#define ALGO_CPF = 0
30
@#endif
31
@#ifndef ALGO_GPF
32
    @#define ALGO_GPF = 0
33
34
@#endif
@#ifndef ALGO_GCF
35
    @#define ALGO_GCF = 0
36
37
@#endif
@#ifndef ALGO_GUF
38
    @#define ALGO_GUF = 0
39
40
@#endif
@#ifndef ALGO_GMPF
41
    @#define ALGO_GMPF = 0
42
43
@#endif
@#ifndef ALGO_GMCF
44
    @#define ALGO_GMCF = 0
45
46
@#endif
@#ifndef ALGO_ONLINE_1
47
    @#define ALGO_ONLINE_1 = 0
48
49
@#endif
@#ifndef ALGO_ONLINE_2
50
    @#define ALGO_ONLINE_2 = 0
51
52
@#endif
@#ifndef MCMC
53
    @#define MCMC = 0
54
@#endif
Frédéric Karamé's avatar
Frédéric Karamé committed
55

56
57
58
59
60
61
62
var k A c l i y;
varexo e_a;

parameters alp bet tet tau delt rho ;
alp = 0.4;
bet = 0.99;
tet = 0.357 ;
63
tau =  50 ;
64
65
66
67
68
69
70
71
72
73
74
75
delt = 0.02;
rho = 0.95;

model;
c = ((1 - alp)*tet/(1-tet))*A*(1-l)*((k(-1)/l)^alp) ;
y = A*(k(-1)^alp)*(l^(1-alp)) ;
i = y-c ;
k = (1-delt)*k(-1) + i ;
log(A) = rho*log(A(-1)) + e_a ;
(((c^(tet))*((1-l)^(1-tet)))^(1-tau))/c - bet*((((c(+1)^(tet))*((1-l(+1))^(1-tet)))^(1-tau))/c(+1))*(1 -delt+alp*(A(1)*(k^alp)*(l(1)^(1-alp)))/k)=0 ;
end;

76
77
78
79
80
81
82
83
84
85
86
steady_state_model;

  k = -(alp-1)*(alp^(1/(1-alp)))*(bet^(1/(1-alp)))*((bet*(delt-1)+1)^(alp/(alp-1)))*tet/(-alp*delt*bet+delt*bet+alp*tet*bet-bet-alp*tet+1);
  l = (alp-1)*(bet*(delt-1)+1)*tet/(alp*tet+bet*((alp-1)*delt-alp*tet+1)-1) ;
  y = (k^alp)*(l^(1-alp)) ;
  i = delt*k ;
  c = y - i ;
  A = 1;

end;

87
shocks;
88
var e_a; stderr 0.035;
89
90
91
92
93
end;

steady;

estimated_params;
94
alp, uniform_pdf,,, 0.0001, 0.99;
Frédéric Karamé's avatar
Frédéric Karamé committed
95
bet, uniform_pdf,,, 0.0001, 0.99999;
96
tet, uniform_pdf,,, 0.0001, .999;
97
98
tau, uniform_pdf,,, 0.0001, 100;
delt, uniform_pdf,,, 0.0001, 0.05;
99
rho, uniform_pdf,,, 0.0001, 0.9999;
100
101
102
103
104
105
stderr e_a, uniform_pdf,,, 0.00001, 0.1;
stderr y, uniform_pdf,,, 0.00001, 0.1;
stderr l, uniform_pdf,,, 0.00001, 0.1;
stderr i, uniform_pdf,,, 0.00001, 0.1;
end;

106
@#if EXTREME_CALIBRATION
107
108
109
110
111
112
113
114
115
116
117
118
119
120
  estimated_params_init;
  alp, 0.4;
  bet, 0.99;
  tet, 0.357;
  tau, 50;
  delt, 0.02;
  rho, 0.95;
  stderr e_a, .035;
  stderr y, .00158;
  stderr l, .0011;
  stderr i, .000866;
  end;
@#endif

121
@#if RISKY_CALIBRATION
122
123
124
125
126
127
128
129
130
131
132
133
134
  estimated_params_init;
  alp, 0.4;
  bet, 0.99;
  tet, 0.357;
  tau, 50;
  delt, 0.02;
  rho, 0.95;
  stderr e_a, .035;
  stderr y, .0175;
  stderr l, .00312;
  stderr i, .00465;
  end;
@#endif
Frédéric Karamé's avatar
Frédéric Karamé committed
135

136
varobs y l i ;
137

138
options_.mode_check.neighbourhood_size = .1 ;
139
options_.mode_check.number_of_points = 250;
140
options_.threads.local_state_space_iteration_2 = 4;
Frédéric Karamé's avatar
Frédéric Karamé committed
141

142
143
@#if EXTREME_CALIBRATION
  data(file='./extreme.m');
Frédéric Karamé's avatar
Frédéric Karamé committed
144
145
146
@#endif 

@#if RISKY_CALIBRATION
147
148
149
    data(file='./risky.m');
@#endif

Frédéric Karamé's avatar
Frédéric Karamé committed
150
151
152
153
154
@#if BENCHMARK_CALIBRATION
    data(file='./benchmark.m');
@#endif


155
@#if LINEAR_KALMAN
156
157
158
159
160
  estimation(nograph,order=1,mode_compute=8,mh_replic=0,mode_check);
@#endif

@#if NON_LINEAR_KALMAN
  estimation(nograph,order=2,filter_algorithm=nlkf,mode_compute=8,mh_replic=0);
161
162
163
@#endif

@#if ALGO_SIR
164
  estimation(order=2,nograph,number_of_particles=1000,mh_replic=0,mode_compute=8);
165
166
167
@#endif

@#if ALGO_SISmoothR
168
169
  estimation(order=2,nograph,number_of_particles=1000,resampling_method=smooth,mode_compute=8,mh_replic=0);
  estimation(order=2,nograph,number_of_particles=1000,resampling_method=smooth,mode_compute=8,mode_file=dsge_base2_mode,mh_replic=0);
170
171
172
173
  estimation(order=2,nograph,number_of_particles=1000,resampling_method=smooth,mode_compute=4,mode_file=dsge_base2_mode,mh_replic=0,mode_check);
@#endif

@#if ALGO_APF
174
  estimation(order=2,nograph,filter_algorithm=apf,number_of_particles=10000,resampling=none,mh_replic=0,mode_compute=8,mode_check);
175
176
@#endif

177
178
179
180
@#if ALGO_CPF
  estimation(order=2,nograph,filter_algorithm=cpf,number_of_particles=10000,resampling=none,mh_replic=0,mode_compute=8,mode_check);
@#endif

181
182
183
184
185
186
187
188
189
190
191
@#if ALGO_GPF
  estimation(order=2,nograph,filter_algorithm=gf,distribution_approximation=montecarlo,number_of_particles=1000,mh_replic=0,mode_compute=8);
  estimation(order=2,nograph,filter_algorithm=gf,distribution_approximation=montecarlo,number_of_particles=1000,mode_file=dsge_base2_mode,mh_replic=0,mode_compute=4,mode_check);
@#endif

@#if ALGO_GCF
  estimation(order=2,nograph,filter_algorithm=gf,mh_replic=0,mode_compute=8);
  estimation(order=2,nograph,filter_algorithm=gf,mh_replic=0,mode_compute=4,mode_file=dsge_base2_mode,mode_check);
@#endif

@#if ALGO_GUF
192
  estimation(order=2,nograph,filter_algorithm=gf,proposal_approximation=unscented,distribution_approximation=unscented,mh_replic=0,mode_compute=8);
193
194
195
196
197
198
199
200
201
202
  estimation(order=2,nograph,filter_algorithm=gf,proposal_approximation=unscented,distribution_approximation=unscented,mh_replic=0,mode_compute=8,mode_check);
@#endif

@#if ALGO_GMPF
  estimation(nograph,order=2,filter_algorithm=gmf,distribution_approximation=montecarlo,number_of_particles=1000,mh_replic=0,mode_compute=8);
  estimation(nograph,order=2,filter_algorithm=gmf,distribution_approximation=montecarlo,number_of_particles=1000,mh_replic=0,mode_file=dsge_base2_mode,mode_compute=8);
  estimation(nograph,order=2,filter_algorithm=gmf,distribution_approximation=montecarlo,number_of_particles=1000,mh_replic=0,mode_file=dsge_base2_mode,mode_compute=4,mode_check);
@#endif

@#if ALGO_GMCF
203
  estimation(nograph,order=2,filter_algorithm=gmf,mh_replic=0,mode_compute=8);
204
205
206
207
  estimation(nograph,order=2,filter_algorithm=gmf,mh_replic=0,mode_compute=4,mode_file=dsge_base2_mode,mode_check);
@#endif

@#if ALGO_ONLINE_2
208
  estimation(order=2,number_of_particles=1000,mode_compute=11,mh_replic=0,particle_filter_options=('liu_west_delta',0.9));
209
210
211
@#endif

@#if ALGO_ONLINE_1
212
  estimation(order=1,number_of_particles=1000,mode_compute=11,mh_replic=0,particle_filter_options=('liu_west_delta',0.9));
213
@#endif
Frédéric Karamé's avatar
Frédéric Karamé committed
214

215
216
217
218
219
@#if MCMC
  options_.mh_nblck = 10 ;
  options_.posterior_sampling_method = 'RWGMH';
  options_.rwgmh_scale_shock = (1e-5)*[10 10 1 1 10 10 10 1000 10 10] ;
  estimation(order=1,mh_replic=5000,mode_compute=0,mode_file=dsge_base2_mode);
Stéphane Adjemian's avatar
Stéphane Adjemian committed
220
@#endif