Encoding fixes.
parent
75a929051f
commit
7e7f57d7d1
|
@ -132,7 +132,7 @@ oo_.surgibbs.(model_name).posterior.mean.beta = (sum(oo_.surgibbs.(model_name).b
|
|||
oo_.surgibbs.(model_name).posterior.variance.beta = cov(oo_.surgibbs.(model_name).betadraws);
|
||||
|
||||
% Yhat
|
||||
oo_.surgibbs.(model_name).Yhat = X*oo_.surgibbs.(model_name).posterior.mean.beta;
|
||||
oo_.surgibbs.(model_name).Yhat = X*oo_.surgibbs.(model_name).posterior.mean.beta;
|
||||
|
||||
% Residuals
|
||||
oo_.surgibbs.(model_name).resid = Y - oo_.surgibbs.(model_name).Yhat;
|
||||
|
@ -181,7 +181,7 @@ if ~options_.noprint
|
|||
sprintf('No. Equations: %d', oo_.surgibbs.(model_name).neqs), ...
|
||||
sprintf('No. Independent Variables: %d', size(X, 2)), ...
|
||||
sprintf('Observations: %d', oo_.surgibbs.(model_name).dof)};
|
||||
|
||||
|
||||
afterward = {sprintf('s^2: %f', oo_.surgibbs.(model_name).s2), sprintf('R^2: %f', oo_.surgibbs.(model_name).R2)};
|
||||
dyn_table(ttitle, preamble, afterward, param_names,...
|
||||
{'Posterior mean', 'Posterior std.'}, 4,...
|
||||
|
|
|
@ -1,223 +1,223 @@
|
|||
// --+ options: json=compute +--
|
||||
|
||||
/* REMARK
|
||||
** ------
|
||||
**
|
||||
** You need to have the first line on top of the mod file. The options defined on this line are passed
|
||||
** to the dynare command (you can add other options, separated by spaces or commas). The option defined
|
||||
** here is mandatory for the decomposition. It forces Dynare to output another representation of the
|
||||
** model in JSON file (additionaly to the matlab files) which is used here to manipulate the equations.
|
||||
*/
|
||||
|
||||
var
|
||||
U2_Q_YED
|
||||
U2_G_YER
|
||||
U2_STN
|
||||
U2_ESTN
|
||||
U2_EHIC
|
||||
DE_Q_YED
|
||||
DE_G_YER
|
||||
DE_EHIC
|
||||
|
||||
;
|
||||
|
||||
varexo
|
||||
res_U2_Q_YED
|
||||
res_U2_G_YER
|
||||
res_U2_STN
|
||||
res_U2_ESTN
|
||||
res_U2_EHIC
|
||||
res_DE_Q_YED
|
||||
res_DE_G_YER
|
||||
res_DE_EHIC
|
||||
;
|
||||
|
||||
parameters
|
||||
u2_q_yed_ecm_u2_q_yed_L1
|
||||
u2_q_yed_ecm_u2_stn_L1
|
||||
u2_q_yed_u2_g_yer_L1
|
||||
u2_q_yed_u2_stn_L1
|
||||
u2_g_yer_ecm_u2_q_yed_L1
|
||||
u2_g_yer_ecm_u2_stn_L1
|
||||
u2_g_yer_u2_q_yed_L1
|
||||
u2_g_yer_u2_g_yer_L1
|
||||
u2_g_yer_u2_stn_L1
|
||||
u2_stn_ecm_u2_q_yed_L1
|
||||
u2_stn_ecm_u2_stn_L1
|
||||
u2_stn_u2_q_yed_L1
|
||||
u2_stn_u2_g_yer_L1
|
||||
u2_estn_u2_estn_L1
|
||||
u2_ehic_u2_ehic_L1
|
||||
|
||||
de_q_yed_ecm_de_q_yed_L1
|
||||
de_q_yed_ecm_u2_stn_L1
|
||||
de_q_yed_de_g_yer_L1
|
||||
de_q_yed_u2_stn_L1
|
||||
de_g_yer_ecm_de_q_yed_L1
|
||||
de_g_yer_ecm_u2_stn_L1
|
||||
de_g_yer_de_q_yed_L1
|
||||
de_g_yer_de_g_yer_L1
|
||||
de_g_yer_u2_stn_L1
|
||||
de_ehic_de_ehic_L1
|
||||
|
||||
|
||||
;
|
||||
|
||||
u2_q_yed_ecm_u2_q_yed_L1 = -0.82237516589315 ;
|
||||
u2_q_yed_ecm_u2_stn_L1 = -0.323715338568976 ;
|
||||
u2_q_yed_u2_g_yer_L1 = 0.0401361895021084 ;
|
||||
u2_q_yed_u2_stn_L1 = 0.058397703958446 ;
|
||||
u2_g_yer_ecm_u2_q_yed_L1 = 0.0189896046977421 ;
|
||||
u2_g_yer_ecm_u2_stn_L1 = -0.109597659887432 ;
|
||||
u2_g_yer_u2_q_yed_L1 = 0.0037667967632025 ;
|
||||
u2_g_yer_u2_g_yer_L1 = 0.480506381923644 ;
|
||||
u2_g_yer_u2_stn_L1 = -0.0722359286123494 ;
|
||||
u2_stn_ecm_u2_q_yed_L1 = -0.0438500662608356 ;
|
||||
u2_stn_ecm_u2_stn_L1 = -0.153283917138772 ;
|
||||
u2_stn_u2_q_yed_L1 = 0.0328744983772825 ;
|
||||
u2_stn_u2_g_yer_L1 = 0.292121949736756 ;
|
||||
u2_estn_u2_estn_L1 = 1 ;
|
||||
u2_ehic_u2_ehic_L1 = 1 ;
|
||||
|
||||
de_q_yed_ecm_de_q_yed_L1 = -0.822375165893149 ;
|
||||
de_q_yed_ecm_u2_stn_L1 = -0.323715338568977 ;
|
||||
de_q_yed_de_g_yer_L1 = 0.0401361895021082 ;
|
||||
de_q_yed_u2_stn_L1 = 0.0583977039584461 ;
|
||||
de_g_yer_ecm_de_q_yed_L1 = 0.0189896046977422 ;
|
||||
de_g_yer_ecm_u2_stn_L1 = -0.109597659887433 ;
|
||||
de_g_yer_de_q_yed_L1 = 0.00376679676320256;
|
||||
de_g_yer_de_g_yer_L1 = 0.480506381923643 ;
|
||||
de_g_yer_u2_stn_L1 = -0.0722359286123494 ;
|
||||
de_ehic_de_ehic_L1 = 1 ;
|
||||
|
||||
|
||||
model(linear);
|
||||
[name = 'eq1']
|
||||
diff(U2_Q_YED) = u2_q_yed_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_q_yed_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ u2_q_yed_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_U2_Q_YED ;
|
||||
[name = 'eq2']
|
||||
diff(U2_G_YER) = u2_g_yer_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_g_yer_u2_q_yed_L1 * diff(U2_Q_YED(-1))
|
||||
+ u2_g_yer_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ u2_g_yer_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_U2_G_YER ;
|
||||
[name = 'eq3']
|
||||
diff(U2_STN) = u2_stn_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_stn_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_stn_u2_q_yed_L1 * diff(U2_Q_YED(-1))
|
||||
+ u2_stn_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ res_U2_STN ;
|
||||
[name = 'eq4']
|
||||
U2_ESTN = u2_estn_u2_estn_L1 * U2_ESTN(-1)
|
||||
+ res_U2_ESTN ;
|
||||
[name = 'eq5']
|
||||
U2_EHIC = u2_ehic_u2_ehic_L1 * U2_EHIC(-1)
|
||||
+ res_U2_EHIC ;
|
||||
[name = 'eq6']
|
||||
diff(DE_Q_YED) = de_q_yed_ecm_de_q_yed_L1 * (DE_Q_YED(-1) - DE_EHIC(-1))
|
||||
+ de_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ de_q_yed_de_g_yer_L1 * diff(DE_G_YER(-1))
|
||||
+ de_q_yed_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_DE_Q_YED ;
|
||||
[name = 'eq7']
|
||||
diff(DE_G_YER) = de_g_yer_ecm_de_q_yed_L1 * (DE_Q_YED(-1) - DE_EHIC(-1))
|
||||
+ de_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ de_g_yer_de_q_yed_L1 * diff(DE_Q_YED(-1))
|
||||
+ de_g_yer_de_g_yer_L1 * diff(DE_G_YER(-1))
|
||||
+ de_g_yer_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_DE_G_YER ;
|
||||
[name = 'eq8']
|
||||
DE_EHIC = DE_EHIC(-1) + res_DE_EHIC ;
|
||||
|
||||
|
||||
|
||||
end;
|
||||
|
||||
shocks;
|
||||
var res_U2_Q_YED = 0.005;
|
||||
var res_U2_G_YER = 0.005;
|
||||
var res_U2_STN = 0.005;
|
||||
var res_U2_ESTN = 0.005;
|
||||
var res_U2_EHIC = 0.005;
|
||||
var res_DE_Q_YED = 0.005;
|
||||
var res_DE_G_YER = 0.005;
|
||||
var res_DE_EHIC = 0.005;
|
||||
end;
|
||||
|
||||
NSIMS = 1;
|
||||
|
||||
options_.noprint = 1;
|
||||
calibrated_values = M_.params;
|
||||
verbatim;
|
||||
Sigma_e = M_.Sigma_e;
|
||||
end;
|
||||
options_.bnlms.set_dynare_seed_to_default = false;
|
||||
|
||||
nparampool = length(M_.params);
|
||||
BETA = zeros(NSIMS, nparampool);
|
||||
for i=1:NSIMS
|
||||
firstobs = rand(3, length(M_.endo_names));
|
||||
M_.params = calibrated_values;
|
||||
M_.Sigma_e = Sigma_e;
|
||||
simdata = simul_backward_model(dseries(firstobs, dates('1995Q1'), M_.endo_names), 10000);
|
||||
simdata = simdata(simdata.dates(5001:6000));
|
||||
names=regexp(simdata.name, 'res\w*');
|
||||
idxs = [];
|
||||
for j=1:length(names)
|
||||
if isempty(names{j})
|
||||
idxs = [idxs j];
|
||||
end
|
||||
end
|
||||
simdata = sur(simdata{idxs});
|
||||
BETA(i, :) = M_.params';
|
||||
oo_ = rmfield(oo_, 'sur');
|
||||
end
|
||||
|
||||
if NSIMS > 1
|
||||
if max(abs(mean(BETA)' - calibrated_values)) > 1e-2
|
||||
error(['sum(abs(mean(BETA)'' - calibrated_values)) ' num2str(sum(abs(mean(BETA)' - calibrated_values)))]);
|
||||
end
|
||||
else
|
||||
good = [-0.826686196809409
|
||||
-0.346753563700393
|
||||
0.063013991583949
|
||||
0.074802596658698
|
||||
-0.017440119721953
|
||||
-0.127090614348862
|
||||
0.025293280404460
|
||||
0.524290302468866
|
||||
-0.117611206771440
|
||||
-0.027776224547132
|
||||
-0.156590828735908
|
||||
0.054039707976331
|
||||
0.276257666502046
|
||||
1.000417289621684
|
||||
0.999336865129450
|
||||
-0.803258152338916
|
||||
-0.309594948488168
|
||||
0.051602756230521
|
||||
0.039275481081030
|
||||
0.024897596371662
|
||||
-0.096310133845385
|
||||
-0.022630284059365
|
||||
0.461683465196454
|
||||
-0.110278113383114
|
||||
1.000000000000000];
|
||||
if max(abs(BETA' - good)) > 1e-14
|
||||
error(['sum of BETA'' - good was: ' num2str(sum(abs(BETA - good)))]);
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
for i=1:nparampool
|
||||
figure
|
||||
hold on
|
||||
title(strrep(M_.param_names(i,:), '_', '\_'));
|
||||
histogram(BETA(:,i),50);
|
||||
line([calibrated_values(i) calibrated_values(i)], [0 NSIMS/10], 'LineWidth', 2, 'Color', 'r');
|
||||
hold off
|
||||
end
|
||||
// --+ options: json=compute +--
|
||||
|
||||
/* REMARK
|
||||
** ------
|
||||
**
|
||||
** You need to have the first line on top of the mod file. The options defined on this line are passed
|
||||
** to the dynare command (you can add other options, separated by spaces or commas). The option defined
|
||||
** here is mandatory for the decomposition. It forces Dynare to output another representation of the
|
||||
** model in JSON file (additionaly to the matlab files) which is used here to manipulate the equations.
|
||||
*/
|
||||
|
||||
var
|
||||
U2_Q_YED
|
||||
U2_G_YER
|
||||
U2_STN
|
||||
U2_ESTN
|
||||
U2_EHIC
|
||||
DE_Q_YED
|
||||
DE_G_YER
|
||||
DE_EHIC
|
||||
|
||||
;
|
||||
|
||||
varexo
|
||||
res_U2_Q_YED
|
||||
res_U2_G_YER
|
||||
res_U2_STN
|
||||
res_U2_ESTN
|
||||
res_U2_EHIC
|
||||
res_DE_Q_YED
|
||||
res_DE_G_YER
|
||||
res_DE_EHIC
|
||||
;
|
||||
|
||||
parameters
|
||||
u2_q_yed_ecm_u2_q_yed_L1
|
||||
u2_q_yed_ecm_u2_stn_L1
|
||||
u2_q_yed_u2_g_yer_L1
|
||||
u2_q_yed_u2_stn_L1
|
||||
u2_g_yer_ecm_u2_q_yed_L1
|
||||
u2_g_yer_ecm_u2_stn_L1
|
||||
u2_g_yer_u2_q_yed_L1
|
||||
u2_g_yer_u2_g_yer_L1
|
||||
u2_g_yer_u2_stn_L1
|
||||
u2_stn_ecm_u2_q_yed_L1
|
||||
u2_stn_ecm_u2_stn_L1
|
||||
u2_stn_u2_q_yed_L1
|
||||
u2_stn_u2_g_yer_L1
|
||||
u2_estn_u2_estn_L1
|
||||
u2_ehic_u2_ehic_L1
|
||||
|
||||
de_q_yed_ecm_de_q_yed_L1
|
||||
de_q_yed_ecm_u2_stn_L1
|
||||
de_q_yed_de_g_yer_L1
|
||||
de_q_yed_u2_stn_L1
|
||||
de_g_yer_ecm_de_q_yed_L1
|
||||
de_g_yer_ecm_u2_stn_L1
|
||||
de_g_yer_de_q_yed_L1
|
||||
de_g_yer_de_g_yer_L1
|
||||
de_g_yer_u2_stn_L1
|
||||
de_ehic_de_ehic_L1
|
||||
|
||||
|
||||
;
|
||||
|
||||
u2_q_yed_ecm_u2_q_yed_L1 = -0.82237516589315 ;
|
||||
u2_q_yed_ecm_u2_stn_L1 = -0.323715338568976 ;
|
||||
u2_q_yed_u2_g_yer_L1 = 0.0401361895021084 ;
|
||||
u2_q_yed_u2_stn_L1 = 0.058397703958446 ;
|
||||
u2_g_yer_ecm_u2_q_yed_L1 = 0.0189896046977421 ;
|
||||
u2_g_yer_ecm_u2_stn_L1 = -0.109597659887432 ;
|
||||
u2_g_yer_u2_q_yed_L1 = 0.0037667967632025 ;
|
||||
u2_g_yer_u2_g_yer_L1 = 0.480506381923644 ;
|
||||
u2_g_yer_u2_stn_L1 = -0.0722359286123494 ;
|
||||
u2_stn_ecm_u2_q_yed_L1 = -0.0438500662608356 ;
|
||||
u2_stn_ecm_u2_stn_L1 = -0.153283917138772 ;
|
||||
u2_stn_u2_q_yed_L1 = 0.0328744983772825 ;
|
||||
u2_stn_u2_g_yer_L1 = 0.292121949736756 ;
|
||||
u2_estn_u2_estn_L1 = 1 ;
|
||||
u2_ehic_u2_ehic_L1 = 1 ;
|
||||
|
||||
de_q_yed_ecm_de_q_yed_L1 = -0.822375165893149 ;
|
||||
de_q_yed_ecm_u2_stn_L1 = -0.323715338568977 ;
|
||||
de_q_yed_de_g_yer_L1 = 0.0401361895021082 ;
|
||||
de_q_yed_u2_stn_L1 = 0.0583977039584461 ;
|
||||
de_g_yer_ecm_de_q_yed_L1 = 0.0189896046977422 ;
|
||||
de_g_yer_ecm_u2_stn_L1 = -0.109597659887433 ;
|
||||
de_g_yer_de_q_yed_L1 = 0.00376679676320256;
|
||||
de_g_yer_de_g_yer_L1 = 0.480506381923643 ;
|
||||
de_g_yer_u2_stn_L1 = -0.0722359286123494 ;
|
||||
de_ehic_de_ehic_L1 = 1 ;
|
||||
|
||||
|
||||
model(linear);
|
||||
[name = 'eq1']
|
||||
diff(U2_Q_YED) = u2_q_yed_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_q_yed_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ u2_q_yed_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_U2_Q_YED ;
|
||||
[name = 'eq2']
|
||||
diff(U2_G_YER) = u2_g_yer_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_g_yer_u2_q_yed_L1 * diff(U2_Q_YED(-1))
|
||||
+ u2_g_yer_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ u2_g_yer_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_U2_G_YER ;
|
||||
[name = 'eq3']
|
||||
diff(U2_STN) = u2_stn_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_stn_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_stn_u2_q_yed_L1 * diff(U2_Q_YED(-1))
|
||||
+ u2_stn_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ res_U2_STN ;
|
||||
[name = 'eq4']
|
||||
U2_ESTN = u2_estn_u2_estn_L1 * U2_ESTN(-1)
|
||||
+ res_U2_ESTN ;
|
||||
[name = 'eq5']
|
||||
U2_EHIC = u2_ehic_u2_ehic_L1 * U2_EHIC(-1)
|
||||
+ res_U2_EHIC ;
|
||||
[name = 'eq6']
|
||||
diff(DE_Q_YED) = de_q_yed_ecm_de_q_yed_L1 * (DE_Q_YED(-1) - DE_EHIC(-1))
|
||||
+ de_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ de_q_yed_de_g_yer_L1 * diff(DE_G_YER(-1))
|
||||
+ de_q_yed_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_DE_Q_YED ;
|
||||
[name = 'eq7']
|
||||
diff(DE_G_YER) = de_g_yer_ecm_de_q_yed_L1 * (DE_Q_YED(-1) - DE_EHIC(-1))
|
||||
+ de_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ de_g_yer_de_q_yed_L1 * diff(DE_Q_YED(-1))
|
||||
+ de_g_yer_de_g_yer_L1 * diff(DE_G_YER(-1))
|
||||
+ de_g_yer_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_DE_G_YER ;
|
||||
[name = 'eq8']
|
||||
DE_EHIC = DE_EHIC(-1) + res_DE_EHIC ;
|
||||
|
||||
|
||||
|
||||
end;
|
||||
|
||||
shocks;
|
||||
var res_U2_Q_YED = 0.005;
|
||||
var res_U2_G_YER = 0.005;
|
||||
var res_U2_STN = 0.005;
|
||||
var res_U2_ESTN = 0.005;
|
||||
var res_U2_EHIC = 0.005;
|
||||
var res_DE_Q_YED = 0.005;
|
||||
var res_DE_G_YER = 0.005;
|
||||
var res_DE_EHIC = 0.005;
|
||||
end;
|
||||
|
||||
NSIMS = 1;
|
||||
|
||||
options_.noprint = 1;
|
||||
calibrated_values = M_.params;
|
||||
verbatim;
|
||||
Sigma_e = M_.Sigma_e;
|
||||
end;
|
||||
options_.bnlms.set_dynare_seed_to_default = false;
|
||||
|
||||
nparampool = length(M_.params);
|
||||
BETA = zeros(NSIMS, nparampool);
|
||||
for i=1:NSIMS
|
||||
firstobs = rand(3, length(M_.endo_names));
|
||||
M_.params = calibrated_values;
|
||||
M_.Sigma_e = Sigma_e;
|
||||
simdata = simul_backward_model(dseries(firstobs, dates('1995Q1'), M_.endo_names), 10000);
|
||||
simdata = simdata(simdata.dates(5001:6000));
|
||||
names=regexp(simdata.name, 'res\w*');
|
||||
idxs = [];
|
||||
for j=1:length(names)
|
||||
if isempty(names{j})
|
||||
idxs = [idxs j];
|
||||
end
|
||||
end
|
||||
simdata = sur(simdata{idxs});
|
||||
BETA(i, :) = M_.params';
|
||||
oo_ = rmfield(oo_, 'sur');
|
||||
end
|
||||
|
||||
if NSIMS > 1
|
||||
if max(abs(mean(BETA)' - calibrated_values)) > 1e-2
|
||||
error(['sum(abs(mean(BETA)'' - calibrated_values)) ' num2str(sum(abs(mean(BETA)' - calibrated_values)))]);
|
||||
end
|
||||
else
|
||||
good = [-0.826686196809409
|
||||
-0.346753563700393
|
||||
0.063013991583949
|
||||
0.074802596658698
|
||||
-0.017440119721953
|
||||
-0.127090614348862
|
||||
0.025293280404460
|
||||
0.524290302468866
|
||||
-0.117611206771440
|
||||
-0.027776224547132
|
||||
-0.156590828735908
|
||||
0.054039707976331
|
||||
0.276257666502046
|
||||
1.000417289621684
|
||||
0.999336865129450
|
||||
-0.803258152338916
|
||||
-0.309594948488168
|
||||
0.051602756230521
|
||||
0.039275481081030
|
||||
0.024897596371662
|
||||
-0.096310133845385
|
||||
-0.022630284059365
|
||||
0.461683465196454
|
||||
-0.110278113383114
|
||||
1.000000000000000];
|
||||
if max(abs(BETA' - good)) > 1e-14
|
||||
error(['sum of BETA'' - good was: ' num2str(sum(abs(BETA - good)))]);
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
for i=1:nparampool
|
||||
figure
|
||||
hold on
|
||||
title(strrep(M_.param_names(i,:), '_', '\_'));
|
||||
histogram(BETA(:,i),50);
|
||||
line([calibrated_values(i) calibrated_values(i)], [0 NSIMS/10], 'LineWidth', 2, 'Color', 'r');
|
||||
hold off
|
||||
end
|
||||
|
|
|
@ -1,222 +1,222 @@
|
|||
// --+ options: json=compute +--
|
||||
|
||||
/* REMARK
|
||||
** ------
|
||||
**
|
||||
** You need to have the first line on top of the mod file. The options defined on this line are passed
|
||||
** to the dynare command (you can add other options, separated by spaces or commas). The option defined
|
||||
** here is mandatory for the decomposition. It forces Dynare to output another representation of the
|
||||
** model in JSON file (additionaly to the matlab files) which is used here to manipulate the equations.
|
||||
*/
|
||||
|
||||
var
|
||||
U2_Q_YED
|
||||
U2_G_YER
|
||||
U2_STN
|
||||
U2_ESTN
|
||||
U2_EHIC
|
||||
DE_Q_YED
|
||||
DE_G_YER
|
||||
DE_EHIC
|
||||
;
|
||||
|
||||
varexo
|
||||
res_U2_Q_YED
|
||||
res_U2_G_YER
|
||||
res_U2_STN
|
||||
res_DE_Q_YED
|
||||
res_DE_G_YER
|
||||
res_DE_EHIC
|
||||
;
|
||||
|
||||
parameters
|
||||
u2_q_yed_ecm_u2_q_yed_L1
|
||||
u2_q_yed_ecm_u2_stn_L1
|
||||
u2_q_yed_u2_g_yer_L1
|
||||
u2_q_yed_u2_stn_L1
|
||||
u2_g_yer_ecm_u2_q_yed_L1
|
||||
u2_g_yer_ecm_u2_stn_L1
|
||||
u2_g_yer_u2_q_yed_L1
|
||||
u2_g_yer_u2_g_yer_L1
|
||||
u2_g_yer_u2_stn_L1
|
||||
u2_stn_ecm_u2_q_yed_L1
|
||||
u2_stn_ecm_u2_stn_L1
|
||||
u2_stn_u2_q_yed_L1
|
||||
u2_stn_u2_g_yer_L1
|
||||
u2_estn_u2_estn_L1
|
||||
u2_ehic_u2_ehic_L1
|
||||
|
||||
de_q_yed_ecm_de_q_yed_L1
|
||||
de_q_yed_ecm_u2_stn_L1
|
||||
de_q_yed_de_g_yer_L1
|
||||
de_q_yed_u2_stn_L1
|
||||
de_g_yer_ecm_de_q_yed_L1
|
||||
de_g_yer_ecm_u2_stn_L1
|
||||
de_g_yer_de_q_yed_L1
|
||||
de_g_yer_de_g_yer_L1
|
||||
de_g_yer_u2_stn_L1
|
||||
de_ehic_de_ehic_L1
|
||||
;
|
||||
|
||||
u2_q_yed_ecm_u2_q_yed_L1 = -0.82237516589315 ;
|
||||
u2_q_yed_ecm_u2_stn_L1 = -0.323715338568976 ;
|
||||
u2_q_yed_u2_g_yer_L1 = 0.0401361895021084 ;
|
||||
u2_q_yed_u2_stn_L1 = 0.058397703958446 ;
|
||||
u2_g_yer_ecm_u2_q_yed_L1 = 0.0189896046977421 ;
|
||||
u2_g_yer_ecm_u2_stn_L1 = -0.109597659887432 ;
|
||||
u2_g_yer_u2_q_yed_L1 = 0.0037667967632025 ;
|
||||
u2_g_yer_u2_g_yer_L1 = 0.480506381923644 ;
|
||||
u2_g_yer_u2_stn_L1 = -0.0722359286123494 ;
|
||||
u2_stn_ecm_u2_q_yed_L1 = -0.0438500662608356 ;
|
||||
u2_stn_ecm_u2_stn_L1 = -0.153283917138772 ;
|
||||
u2_stn_u2_q_yed_L1 = 0.0328744983772825 ;
|
||||
u2_stn_u2_g_yer_L1 = 0.292121949736756 ;
|
||||
u2_estn_u2_estn_L1 = 1 ;
|
||||
u2_ehic_u2_ehic_L1 = 1 ;
|
||||
|
||||
de_q_yed_ecm_de_q_yed_L1 = -0.822375165893149 ;
|
||||
de_q_yed_ecm_u2_stn_L1 = -0.323715338568977 ;
|
||||
de_q_yed_de_g_yer_L1 = 0.0401361895021082 ;
|
||||
de_q_yed_u2_stn_L1 = 0.0583977039584461 ;
|
||||
de_g_yer_ecm_de_q_yed_L1 = 0.0189896046977422 ;
|
||||
de_g_yer_ecm_u2_stn_L1 = -0.109597659887433 ;
|
||||
de_g_yer_de_q_yed_L1 = 0.00376679676320256;
|
||||
de_g_yer_de_g_yer_L1 = 0.480506381923643 ;
|
||||
de_g_yer_u2_stn_L1 = -0.0722359286123494 ;
|
||||
de_ehic_de_ehic_L1 = 1 ;
|
||||
|
||||
|
||||
model(linear);
|
||||
[name = 'eq1']
|
||||
diff(U2_Q_YED) = u2_q_yed_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_q_yed_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ u2_q_yed_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_U2_Q_YED ;
|
||||
|
||||
[name = 'eq2']
|
||||
diff(U2_G_YER) = u2_g_yer_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_g_yer_u2_q_yed_L1 * diff(U2_Q_YED(-1))
|
||||
+ u2_g_yer_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ u2_g_yer_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_U2_G_YER ;
|
||||
|
||||
[name = 'eq3']
|
||||
diff(U2_STN) = u2_stn_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_stn_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_stn_u2_q_yed_L1 * diff(U2_Q_YED(-1))
|
||||
+ u2_stn_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ res_U2_STN ;
|
||||
|
||||
[name = 'eq4']
|
||||
U2_ESTN = 0 ;
|
||||
|
||||
[name = 'eq5']
|
||||
U2_EHIC = 0 ;
|
||||
|
||||
[name = 'eq6']
|
||||
diff(DE_Q_YED) = de_q_yed_ecm_de_q_yed_L1 * (DE_Q_YED(-1) - DE_EHIC(-1))
|
||||
+ de_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ de_q_yed_de_g_yer_L1 * diff(DE_G_YER(-1))
|
||||
+ de_q_yed_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_DE_Q_YED ;
|
||||
|
||||
[name = 'eq7']
|
||||
diff(DE_G_YER) = de_g_yer_ecm_de_q_yed_L1 * (DE_Q_YED(-1) - DE_EHIC(-1))
|
||||
+ de_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ de_g_yer_de_q_yed_L1 * diff(DE_Q_YED(-1))
|
||||
+ de_g_yer_de_g_yer_L1 * diff(DE_G_YER(-1))
|
||||
+ de_g_yer_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_DE_G_YER ;
|
||||
|
||||
[name = 'eq8']
|
||||
DE_EHIC = DE_EHIC(-1) + res_DE_EHIC ;
|
||||
|
||||
end;
|
||||
|
||||
shocks;
|
||||
var res_U2_Q_YED = 0.005;
|
||||
var res_U2_G_YER = 0.005;
|
||||
var res_U2_STN = 0.005;
|
||||
var res_DE_Q_YED = 0.005;
|
||||
var res_DE_G_YER = 0.005;
|
||||
var res_DE_EHIC = 0.005;
|
||||
end;
|
||||
|
||||
NSIMS = 1;
|
||||
|
||||
options_.noprint = 1;
|
||||
calibrated_values = M_.params;
|
||||
verbatim;
|
||||
Sigma_e = M_.Sigma_e;
|
||||
end;
|
||||
options_.bnlms.set_dynare_seed_to_default = false;
|
||||
|
||||
nparampool = length(M_.params);
|
||||
BETA = zeros(NSIMS, nparampool);
|
||||
for i=1:NSIMS
|
||||
firstobs = rand(3, length(M_.endo_names));
|
||||
M_.params = calibrated_values;
|
||||
M_.Sigma_e = Sigma_e;
|
||||
simdata = simul_backward_model(dseries(firstobs, dates('1995Q1'), M_.endo_names), 10000);
|
||||
simdata = simdata(simdata.dates(5001:6000));
|
||||
% fill zeroed-out variables with random data to ensure they are not being referenced
|
||||
simdata.U2_EHIC = dseries(rand(1000, 1), simdata.firstdate, 'U2_EHIC');
|
||||
simdata.U2_ESTN = dseries(rand(1000, 1), simdata.firstdate, 'U2_ESTN');
|
||||
names = regexp(simdata.name, 'res\w*');
|
||||
idxs = [];
|
||||
for j=1:length(names)
|
||||
if isempty(names{j})
|
||||
idxs = [idxs j];
|
||||
end
|
||||
end
|
||||
simdata = sur(simdata{idxs});
|
||||
BETA(i, :) = M_.params';
|
||||
oo_ = rmfield(oo_, 'sur');
|
||||
end
|
||||
|
||||
if NSIMS > 1
|
||||
if max(abs(mean(BETA)' - calibrated_values)) > 1e-2
|
||||
error(['sum(abs(mean(BETA)'' - calibrated_values)) ' num2str(sum(abs(mean(BETA)' - calibrated_values)))]);
|
||||
end
|
||||
else
|
||||
good = [-0.806260229719792
|
||||
-0.354371215026078
|
||||
0.067618717060638
|
||||
0.088053231576354
|
||||
-0.057161898696690
|
||||
-0.136999143481575
|
||||
0.052047088887385
|
||||
0.524022502978068
|
||||
-0.110211572532150
|
||||
-0.041415758049800
|
||||
-0.162997606880957
|
||||
0.091000830792721
|
||||
0.281196660545012
|
||||
1.000000000000000
|
||||
1.000000000000000
|
||||
-0.823354793011220
|
||||
-0.337521089381118
|
||||
0.025493177305917
|
||||
0.059513905441361
|
||||
0.016845886773011
|
||||
-0.151537340795868
|
||||
0.004832174649536
|
||||
0.430883913061161
|
||||
-0.071743697511067
|
||||
1.000000000000000];
|
||||
if max(abs(BETA' - good)) > 1e-14
|
||||
error(['sum of BETA'' - good was: ' num2str(sum(abs(BETA - good)))]);
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
for i=1:nparampool
|
||||
figure
|
||||
hold on
|
||||
title(strrep(M_.param_names(i,:), '_', '\_'));
|
||||
histogram(BETA(:,i),50);
|
||||
line([calibrated_values(i) calibrated_values(i)], [0 NSIMS/10], 'LineWidth', 2, 'Color', 'r');
|
||||
hold off
|
||||
end
|
||||
// --+ options: json=compute +--
|
||||
|
||||
/* REMARK
|
||||
** ------
|
||||
**
|
||||
** You need to have the first line on top of the mod file. The options defined on this line are passed
|
||||
** to the dynare command (you can add other options, separated by spaces or commas). The option defined
|
||||
** here is mandatory for the decomposition. It forces Dynare to output another representation of the
|
||||
** model in JSON file (additionaly to the matlab files) which is used here to manipulate the equations.
|
||||
*/
|
||||
|
||||
var
|
||||
U2_Q_YED
|
||||
U2_G_YER
|
||||
U2_STN
|
||||
U2_ESTN
|
||||
U2_EHIC
|
||||
DE_Q_YED
|
||||
DE_G_YER
|
||||
DE_EHIC
|
||||
;
|
||||
|
||||
varexo
|
||||
res_U2_Q_YED
|
||||
res_U2_G_YER
|
||||
res_U2_STN
|
||||
res_DE_Q_YED
|
||||
res_DE_G_YER
|
||||
res_DE_EHIC
|
||||
;
|
||||
|
||||
parameters
|
||||
u2_q_yed_ecm_u2_q_yed_L1
|
||||
u2_q_yed_ecm_u2_stn_L1
|
||||
u2_q_yed_u2_g_yer_L1
|
||||
u2_q_yed_u2_stn_L1
|
||||
u2_g_yer_ecm_u2_q_yed_L1
|
||||
u2_g_yer_ecm_u2_stn_L1
|
||||
u2_g_yer_u2_q_yed_L1
|
||||
u2_g_yer_u2_g_yer_L1
|
||||
u2_g_yer_u2_stn_L1
|
||||
u2_stn_ecm_u2_q_yed_L1
|
||||
u2_stn_ecm_u2_stn_L1
|
||||
u2_stn_u2_q_yed_L1
|
||||
u2_stn_u2_g_yer_L1
|
||||
u2_estn_u2_estn_L1
|
||||
u2_ehic_u2_ehic_L1
|
||||
|
||||
de_q_yed_ecm_de_q_yed_L1
|
||||
de_q_yed_ecm_u2_stn_L1
|
||||
de_q_yed_de_g_yer_L1
|
||||
de_q_yed_u2_stn_L1
|
||||
de_g_yer_ecm_de_q_yed_L1
|
||||
de_g_yer_ecm_u2_stn_L1
|
||||
de_g_yer_de_q_yed_L1
|
||||
de_g_yer_de_g_yer_L1
|
||||
de_g_yer_u2_stn_L1
|
||||
de_ehic_de_ehic_L1
|
||||
;
|
||||
|
||||
u2_q_yed_ecm_u2_q_yed_L1 = -0.82237516589315 ;
|
||||
u2_q_yed_ecm_u2_stn_L1 = -0.323715338568976 ;
|
||||
u2_q_yed_u2_g_yer_L1 = 0.0401361895021084 ;
|
||||
u2_q_yed_u2_stn_L1 = 0.058397703958446 ;
|
||||
u2_g_yer_ecm_u2_q_yed_L1 = 0.0189896046977421 ;
|
||||
u2_g_yer_ecm_u2_stn_L1 = -0.109597659887432 ;
|
||||
u2_g_yer_u2_q_yed_L1 = 0.0037667967632025 ;
|
||||
u2_g_yer_u2_g_yer_L1 = 0.480506381923644 ;
|
||||
u2_g_yer_u2_stn_L1 = -0.0722359286123494 ;
|
||||
u2_stn_ecm_u2_q_yed_L1 = -0.0438500662608356 ;
|
||||
u2_stn_ecm_u2_stn_L1 = -0.153283917138772 ;
|
||||
u2_stn_u2_q_yed_L1 = 0.0328744983772825 ;
|
||||
u2_stn_u2_g_yer_L1 = 0.292121949736756 ;
|
||||
u2_estn_u2_estn_L1 = 1 ;
|
||||
u2_ehic_u2_ehic_L1 = 1 ;
|
||||
|
||||
de_q_yed_ecm_de_q_yed_L1 = -0.822375165893149 ;
|
||||
de_q_yed_ecm_u2_stn_L1 = -0.323715338568977 ;
|
||||
de_q_yed_de_g_yer_L1 = 0.0401361895021082 ;
|
||||
de_q_yed_u2_stn_L1 = 0.0583977039584461 ;
|
||||
de_g_yer_ecm_de_q_yed_L1 = 0.0189896046977422 ;
|
||||
de_g_yer_ecm_u2_stn_L1 = -0.109597659887433 ;
|
||||
de_g_yer_de_q_yed_L1 = 0.00376679676320256;
|
||||
de_g_yer_de_g_yer_L1 = 0.480506381923643 ;
|
||||
de_g_yer_u2_stn_L1 = -0.0722359286123494 ;
|
||||
de_ehic_de_ehic_L1 = 1 ;
|
||||
|
||||
|
||||
model(linear);
|
||||
[name = 'eq1']
|
||||
diff(U2_Q_YED) = u2_q_yed_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_q_yed_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ u2_q_yed_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_U2_Q_YED ;
|
||||
|
||||
[name = 'eq2']
|
||||
diff(U2_G_YER) = u2_g_yer_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_g_yer_u2_q_yed_L1 * diff(U2_Q_YED(-1))
|
||||
+ u2_g_yer_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ u2_g_yer_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_U2_G_YER ;
|
||||
|
||||
[name = 'eq3']
|
||||
diff(U2_STN) = u2_stn_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_stn_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_stn_u2_q_yed_L1 * diff(U2_Q_YED(-1))
|
||||
+ u2_stn_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ res_U2_STN ;
|
||||
|
||||
[name = 'eq4']
|
||||
U2_ESTN = 0 ;
|
||||
|
||||
[name = 'eq5']
|
||||
U2_EHIC = 0 ;
|
||||
|
||||
[name = 'eq6']
|
||||
diff(DE_Q_YED) = de_q_yed_ecm_de_q_yed_L1 * (DE_Q_YED(-1) - DE_EHIC(-1))
|
||||
+ de_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ de_q_yed_de_g_yer_L1 * diff(DE_G_YER(-1))
|
||||
+ de_q_yed_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_DE_Q_YED ;
|
||||
|
||||
[name = 'eq7']
|
||||
diff(DE_G_YER) = de_g_yer_ecm_de_q_yed_L1 * (DE_Q_YED(-1) - DE_EHIC(-1))
|
||||
+ de_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ de_g_yer_de_q_yed_L1 * diff(DE_Q_YED(-1))
|
||||
+ de_g_yer_de_g_yer_L1 * diff(DE_G_YER(-1))
|
||||
+ de_g_yer_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_DE_G_YER ;
|
||||
|
||||
[name = 'eq8']
|
||||
DE_EHIC = DE_EHIC(-1) + res_DE_EHIC ;
|
||||
|
||||
end;
|
||||
|
||||
shocks;
|
||||
var res_U2_Q_YED = 0.005;
|
||||
var res_U2_G_YER = 0.005;
|
||||
var res_U2_STN = 0.005;
|
||||
var res_DE_Q_YED = 0.005;
|
||||
var res_DE_G_YER = 0.005;
|
||||
var res_DE_EHIC = 0.005;
|
||||
end;
|
||||
|
||||
NSIMS = 1;
|
||||
|
||||
options_.noprint = 1;
|
||||
calibrated_values = M_.params;
|
||||
verbatim;
|
||||
Sigma_e = M_.Sigma_e;
|
||||
end;
|
||||
options_.bnlms.set_dynare_seed_to_default = false;
|
||||
|
||||
nparampool = length(M_.params);
|
||||
BETA = zeros(NSIMS, nparampool);
|
||||
for i=1:NSIMS
|
||||
firstobs = rand(3, length(M_.endo_names));
|
||||
M_.params = calibrated_values;
|
||||
M_.Sigma_e = Sigma_e;
|
||||
simdata = simul_backward_model(dseries(firstobs, dates('1995Q1'), M_.endo_names), 10000);
|
||||
simdata = simdata(simdata.dates(5001:6000));
|
||||
% fill zeroed-out variables with random data to ensure they are not being referenced
|
||||
simdata.U2_EHIC = dseries(rand(1000, 1), simdata.firstdate, 'U2_EHIC');
|
||||
simdata.U2_ESTN = dseries(rand(1000, 1), simdata.firstdate, 'U2_ESTN');
|
||||
names = regexp(simdata.name, 'res\w*');
|
||||
idxs = [];
|
||||
for j=1:length(names)
|
||||
if isempty(names{j})
|
||||
idxs = [idxs j];
|
||||
end
|
||||
end
|
||||
simdata = sur(simdata{idxs});
|
||||
BETA(i, :) = M_.params';
|
||||
oo_ = rmfield(oo_, 'sur');
|
||||
end
|
||||
|
||||
if NSIMS > 1
|
||||
if max(abs(mean(BETA)' - calibrated_values)) > 1e-2
|
||||
error(['sum(abs(mean(BETA)'' - calibrated_values)) ' num2str(sum(abs(mean(BETA)' - calibrated_values)))]);
|
||||
end
|
||||
else
|
||||
good = [-0.806260229719792
|
||||
-0.354371215026078
|
||||
0.067618717060638
|
||||
0.088053231576354
|
||||
-0.057161898696690
|
||||
-0.136999143481575
|
||||
0.052047088887385
|
||||
0.524022502978068
|
||||
-0.110211572532150
|
||||
-0.041415758049800
|
||||
-0.162997606880957
|
||||
0.091000830792721
|
||||
0.281196660545012
|
||||
1.000000000000000
|
||||
1.000000000000000
|
||||
-0.823354793011220
|
||||
-0.337521089381118
|
||||
0.025493177305917
|
||||
0.059513905441361
|
||||
0.016845886773011
|
||||
-0.151537340795868
|
||||
0.004832174649536
|
||||
0.430883913061161
|
||||
-0.071743697511067
|
||||
1.000000000000000];
|
||||
if max(abs(BETA' - good)) > 1e-14
|
||||
error(['sum of BETA'' - good was: ' num2str(sum(abs(BETA - good)))]);
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
for i=1:nparampool
|
||||
figure
|
||||
hold on
|
||||
title(strrep(M_.param_names(i,:), '_', '\_'));
|
||||
histogram(BETA(:,i),50);
|
||||
line([calibrated_values(i) calibrated_values(i)], [0 NSIMS/10], 'LineWidth', 2, 'Color', 'r');
|
||||
hold off
|
||||
end
|
||||
|
|
|
@ -1,223 +1,223 @@
|
|||
// --+ options: json=compute +--
|
||||
|
||||
/* REMARK
|
||||
** ------
|
||||
**
|
||||
** You need to have the first line on top of the mod file. The options defined on this line are passed
|
||||
** to the dynare command (you can add other options, separated by spaces or commas). The option defined
|
||||
** here is mandatory for the decomposition. It forces Dynare to output another representation of the
|
||||
** model in JSON file (additionaly to the matlab files) which is used here to manipulate the equations.
|
||||
*/
|
||||
|
||||
var
|
||||
U2_Q_YED
|
||||
U2_G_YER
|
||||
U2_STN
|
||||
U2_ESTN
|
||||
U2_EHIC
|
||||
DE_Q_YED
|
||||
DE_G_YER
|
||||
DE_EHIC
|
||||
|
||||
;
|
||||
|
||||
varexo
|
||||
res_U2_Q_YED
|
||||
res_U2_G_YER
|
||||
res_U2_STN
|
||||
res_U2_ESTN
|
||||
res_U2_EHIC
|
||||
res_DE_Q_YED
|
||||
res_DE_G_YER
|
||||
res_DE_EHIC
|
||||
;
|
||||
|
||||
parameters
|
||||
u2_q_yed_ecm_u2_q_yed_L1
|
||||
u2_q_yed_ecm_u2_stn_L1
|
||||
u2_q_yed_u2_g_yer_L1
|
||||
u2_q_yed_u2_stn_L1
|
||||
u2_g_yer_ecm_u2_q_yed_L1
|
||||
u2_g_yer_ecm_u2_stn_L1
|
||||
u2_g_yer_u2_q_yed_L1
|
||||
u2_g_yer_u2_g_yer_L1
|
||||
u2_g_yer_u2_stn_L1
|
||||
u2_stn_ecm_u2_q_yed_L1
|
||||
u2_stn_ecm_u2_stn_L1
|
||||
u2_stn_u2_q_yed_L1
|
||||
u2_stn_u2_g_yer_L1
|
||||
u2_estn_u2_estn_L1
|
||||
u2_ehic_u2_ehic_L1
|
||||
|
||||
de_q_yed_ecm_de_q_yed_L1
|
||||
de_q_yed_ecm_u2_stn_L1
|
||||
de_q_yed_de_g_yer_L1
|
||||
de_q_yed_u2_stn_L1
|
||||
de_g_yer_ecm_de_q_yed_L1
|
||||
de_g_yer_ecm_u2_stn_L1
|
||||
de_g_yer_de_q_yed_L1
|
||||
de_g_yer_de_g_yer_L1
|
||||
de_g_yer_u2_stn_L1
|
||||
de_ehic_de_ehic_L1
|
||||
|
||||
|
||||
;
|
||||
|
||||
u2_q_yed_ecm_u2_q_yed_L1 = -0.82237516589315 ;
|
||||
u2_q_yed_ecm_u2_stn_L1 = -0.323715338568976 ;
|
||||
u2_q_yed_u2_g_yer_L1 = 0.0401361895021084 ;
|
||||
u2_q_yed_u2_stn_L1 = 0.058397703958446 ;
|
||||
u2_g_yer_ecm_u2_q_yed_L1 = 0.0189896046977421 ;
|
||||
u2_g_yer_ecm_u2_stn_L1 = -0.109597659887432 ;
|
||||
u2_g_yer_u2_q_yed_L1 = 0.0037667967632025 ;
|
||||
u2_g_yer_u2_g_yer_L1 = 0.480506381923644 ;
|
||||
u2_g_yer_u2_stn_L1 = -0.0722359286123494 ;
|
||||
u2_stn_ecm_u2_q_yed_L1 = -0.0438500662608356 ;
|
||||
u2_stn_ecm_u2_stn_L1 = -0.153283917138772 ;
|
||||
u2_stn_u2_q_yed_L1 = 0.0328744983772825 ;
|
||||
u2_stn_u2_g_yer_L1 = 0.292121949736756 ;
|
||||
u2_estn_u2_estn_L1 = 1 ;
|
||||
u2_ehic_u2_ehic_L1 = 1 ;
|
||||
|
||||
de_q_yed_ecm_de_q_yed_L1 = -0.822375165893149 ;
|
||||
de_q_yed_ecm_u2_stn_L1 = -0.323715338568977 ;
|
||||
de_q_yed_de_g_yer_L1 = 0.0401361895021082 ;
|
||||
de_q_yed_u2_stn_L1 = 0.0583977039584461 ;
|
||||
de_g_yer_ecm_de_q_yed_L1 = 0.0189896046977422 ;
|
||||
de_g_yer_ecm_u2_stn_L1 = -0.109597659887433 ;
|
||||
de_g_yer_de_q_yed_L1 = 0.00376679676320256;
|
||||
de_g_yer_de_g_yer_L1 = 0.480506381923643 ;
|
||||
de_g_yer_u2_stn_L1 = -0.0722359286123494 ;
|
||||
de_ehic_de_ehic_L1 = 1 ;
|
||||
|
||||
|
||||
model(linear);
|
||||
[name = 'eq1']
|
||||
diff(U2_Q_YED) = u2_q_yed_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_q_yed_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ u2_q_yed_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_U2_Q_YED ;
|
||||
[name = 'eq2']
|
||||
diff(U2_G_YER) = u2_g_yer_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_g_yer_u2_q_yed_L1 * diff(U2_Q_YED(-1))
|
||||
+ u2_g_yer_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ u2_g_yer_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_U2_G_YER ;
|
||||
[name = 'eq3']
|
||||
diff(U2_STN) = u2_stn_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_stn_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_stn_u2_q_yed_L1 * diff(U2_Q_YED(-1))
|
||||
+ u2_stn_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ res_U2_STN ;
|
||||
[name = 'eq4']
|
||||
U2_ESTN = u2_estn_u2_estn_L1 * U2_ESTN(-1)
|
||||
+ res_U2_ESTN ;
|
||||
[name = 'eq5']
|
||||
U2_EHIC = u2_ehic_u2_ehic_L1 * U2_EHIC(-1)
|
||||
+ res_U2_EHIC ;
|
||||
[name = 'eq6']
|
||||
diff(DE_Q_YED) = de_q_yed_ecm_de_q_yed_L1 * (DE_Q_YED(-1) - DE_EHIC(-1))
|
||||
+ de_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ de_q_yed_de_g_yer_L1 * diff(DE_G_YER(-1))
|
||||
+ de_q_yed_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_DE_Q_YED ;
|
||||
[name = 'eq7']
|
||||
diff(DE_G_YER) = de_g_yer_ecm_de_q_yed_L1 * (DE_Q_YED(-1) - DE_EHIC(-1))
|
||||
+ de_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ de_g_yer_de_q_yed_L1 * diff(DE_Q_YED(-1))
|
||||
+ de_g_yer_de_g_yer_L1 * diff(DE_G_YER(-1))
|
||||
+ de_g_yer_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_DE_G_YER ;
|
||||
[name = 'eq8']
|
||||
DE_EHIC = DE_EHIC(-1) + res_DE_EHIC ;
|
||||
|
||||
|
||||
|
||||
end;
|
||||
|
||||
shocks;
|
||||
var res_U2_Q_YED = 0.005;
|
||||
var res_U2_G_YER = 0.005;
|
||||
var res_U2_STN = 0.005;
|
||||
var res_U2_ESTN = 0.005;
|
||||
var res_U2_EHIC = 0.005;
|
||||
var res_DE_Q_YED = 0.005;
|
||||
var res_DE_G_YER = 0.005;
|
||||
var res_DE_EHIC = 0.005;
|
||||
end;
|
||||
|
||||
NSIMS = 1;
|
||||
|
||||
options_.noprint = 1;
|
||||
calibrated_values = M_.params;
|
||||
verbatim;
|
||||
Sigma_e = M_.Sigma_e;
|
||||
end;
|
||||
options_.bnlms.set_dynare_seed_to_default = false;
|
||||
|
||||
nparampool = length(M_.params);
|
||||
BETA = zeros(NSIMS, nparampool);
|
||||
for i=1:NSIMS
|
||||
firstobs = rand(3, length(M_.endo_names));
|
||||
M_.params = calibrated_values;
|
||||
M_.Sigma_e = Sigma_e;
|
||||
simdata = simul_backward_model(dseries(firstobs, dates('1995Q1'), M_.endo_names), 10000);
|
||||
simdata = simdata(simdata.dates(5001:6000));
|
||||
names=regexp(simdata.name, 'res\w*');
|
||||
idxs = [];
|
||||
for j=1:length(names)
|
||||
if isempty(names{j})
|
||||
idxs = [idxs j];
|
||||
end
|
||||
end
|
||||
simdata = sur(simdata{idxs}, {}, {}, 'mymodel', true);
|
||||
BETA(i, :) = M_.params';
|
||||
oo_ = rmfield(oo_, 'sur');
|
||||
end
|
||||
|
||||
if NSIMS > 1
|
||||
if max(abs(mean(BETA)' - calibrated_values)) > 1e-2
|
||||
error(['sum(abs(mean(BETA)'' - calibrated_values)) ' num2str(sum(abs(mean(BETA)' - calibrated_values)))]);
|
||||
end
|
||||
else
|
||||
good = [-0.826686383251952
|
||||
-0.346754226737713
|
||||
0.063012625739192
|
||||
0.074803008678581
|
||||
-0.017406695286611
|
||||
-0.127075466955954
|
||||
0.025273119798253
|
||||
0.524311285013928
|
||||
-0.117653504652072
|
||||
-0.027795769946178
|
||||
-0.156599054434094
|
||||
0.054048691636616
|
||||
0.276250884768198
|
||||
1.000417819589230
|
||||
0.999336022919911
|
||||
-0.803262845969268
|
||||
-0.309598590696623
|
||||
0.051598925732525
|
||||
0.039275097813797
|
||||
0.024902442384228
|
||||
-0.096310332265968
|
||||
-0.022625946626029
|
||||
0.461672601960238
|
||||
-0.110232456667380
|
||||
1.000000000000000];
|
||||
if max(abs(BETA' - good)) > 1e-14
|
||||
error(['sum of BETA'' - good was: ' num2str(sum(abs(BETA - good)))]);
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
for i=1:nparampool
|
||||
figure
|
||||
hold on
|
||||
title(strrep(M_.param_names(i,:), '_', '\_'));
|
||||
histogram(BETA(:,i),50);
|
||||
line([calibrated_values(i) calibrated_values(i)], [0 NSIMS/10], 'LineWidth', 2, 'Color', 'r');
|
||||
hold off
|
||||
end
|
||||
// --+ options: json=compute +--
|
||||
|
||||
/* REMARK
|
||||
** ------
|
||||
**
|
||||
** You need to have the first line on top of the mod file. The options defined on this line are passed
|
||||
** to the dynare command (you can add other options, separated by spaces or commas). The option defined
|
||||
** here is mandatory for the decomposition. It forces Dynare to output another representation of the
|
||||
** model in JSON file (additionaly to the matlab files) which is used here to manipulate the equations.
|
||||
*/
|
||||
|
||||
var
|
||||
U2_Q_YED
|
||||
U2_G_YER
|
||||
U2_STN
|
||||
U2_ESTN
|
||||
U2_EHIC
|
||||
DE_Q_YED
|
||||
DE_G_YER
|
||||
DE_EHIC
|
||||
|
||||
;
|
||||
|
||||
varexo
|
||||
res_U2_Q_YED
|
||||
res_U2_G_YER
|
||||
res_U2_STN
|
||||
res_U2_ESTN
|
||||
res_U2_EHIC
|
||||
res_DE_Q_YED
|
||||
res_DE_G_YER
|
||||
res_DE_EHIC
|
||||
;
|
||||
|
||||
parameters
|
||||
u2_q_yed_ecm_u2_q_yed_L1
|
||||
u2_q_yed_ecm_u2_stn_L1
|
||||
u2_q_yed_u2_g_yer_L1
|
||||
u2_q_yed_u2_stn_L1
|
||||
u2_g_yer_ecm_u2_q_yed_L1
|
||||
u2_g_yer_ecm_u2_stn_L1
|
||||
u2_g_yer_u2_q_yed_L1
|
||||
u2_g_yer_u2_g_yer_L1
|
||||
u2_g_yer_u2_stn_L1
|
||||
u2_stn_ecm_u2_q_yed_L1
|
||||
u2_stn_ecm_u2_stn_L1
|
||||
u2_stn_u2_q_yed_L1
|
||||
u2_stn_u2_g_yer_L1
|
||||
u2_estn_u2_estn_L1
|
||||
u2_ehic_u2_ehic_L1
|
||||
|
||||
de_q_yed_ecm_de_q_yed_L1
|
||||
de_q_yed_ecm_u2_stn_L1
|
||||
de_q_yed_de_g_yer_L1
|
||||
de_q_yed_u2_stn_L1
|
||||
de_g_yer_ecm_de_q_yed_L1
|
||||
de_g_yer_ecm_u2_stn_L1
|
||||
de_g_yer_de_q_yed_L1
|
||||
de_g_yer_de_g_yer_L1
|
||||
de_g_yer_u2_stn_L1
|
||||
de_ehic_de_ehic_L1
|
||||
|
||||
|
||||
;
|
||||
|
||||
u2_q_yed_ecm_u2_q_yed_L1 = -0.82237516589315 ;
|
||||
u2_q_yed_ecm_u2_stn_L1 = -0.323715338568976 ;
|
||||
u2_q_yed_u2_g_yer_L1 = 0.0401361895021084 ;
|
||||
u2_q_yed_u2_stn_L1 = 0.058397703958446 ;
|
||||
u2_g_yer_ecm_u2_q_yed_L1 = 0.0189896046977421 ;
|
||||
u2_g_yer_ecm_u2_stn_L1 = -0.109597659887432 ;
|
||||
u2_g_yer_u2_q_yed_L1 = 0.0037667967632025 ;
|
||||
u2_g_yer_u2_g_yer_L1 = 0.480506381923644 ;
|
||||
u2_g_yer_u2_stn_L1 = -0.0722359286123494 ;
|
||||
u2_stn_ecm_u2_q_yed_L1 = -0.0438500662608356 ;
|
||||
u2_stn_ecm_u2_stn_L1 = -0.153283917138772 ;
|
||||
u2_stn_u2_q_yed_L1 = 0.0328744983772825 ;
|
||||
u2_stn_u2_g_yer_L1 = 0.292121949736756 ;
|
||||
u2_estn_u2_estn_L1 = 1 ;
|
||||
u2_ehic_u2_ehic_L1 = 1 ;
|
||||
|
||||
de_q_yed_ecm_de_q_yed_L1 = -0.822375165893149 ;
|
||||
de_q_yed_ecm_u2_stn_L1 = -0.323715338568977 ;
|
||||
de_q_yed_de_g_yer_L1 = 0.0401361895021082 ;
|
||||
de_q_yed_u2_stn_L1 = 0.0583977039584461 ;
|
||||
de_g_yer_ecm_de_q_yed_L1 = 0.0189896046977422 ;
|
||||
de_g_yer_ecm_u2_stn_L1 = -0.109597659887433 ;
|
||||
de_g_yer_de_q_yed_L1 = 0.00376679676320256;
|
||||
de_g_yer_de_g_yer_L1 = 0.480506381923643 ;
|
||||
de_g_yer_u2_stn_L1 = -0.0722359286123494 ;
|
||||
de_ehic_de_ehic_L1 = 1 ;
|
||||
|
||||
|
||||
model(linear);
|
||||
[name = 'eq1']
|
||||
diff(U2_Q_YED) = u2_q_yed_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_q_yed_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ u2_q_yed_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_U2_Q_YED ;
|
||||
[name = 'eq2']
|
||||
diff(U2_G_YER) = u2_g_yer_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_g_yer_u2_q_yed_L1 * diff(U2_Q_YED(-1))
|
||||
+ u2_g_yer_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ u2_g_yer_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_U2_G_YER ;
|
||||
[name = 'eq3']
|
||||
diff(U2_STN) = u2_stn_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_stn_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_stn_u2_q_yed_L1 * diff(U2_Q_YED(-1))
|
||||
+ u2_stn_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ res_U2_STN ;
|
||||
[name = 'eq4']
|
||||
U2_ESTN = u2_estn_u2_estn_L1 * U2_ESTN(-1)
|
||||
+ res_U2_ESTN ;
|
||||
[name = 'eq5']
|
||||
U2_EHIC = u2_ehic_u2_ehic_L1 * U2_EHIC(-1)
|
||||
+ res_U2_EHIC ;
|
||||
[name = 'eq6']
|
||||
diff(DE_Q_YED) = de_q_yed_ecm_de_q_yed_L1 * (DE_Q_YED(-1) - DE_EHIC(-1))
|
||||
+ de_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ de_q_yed_de_g_yer_L1 * diff(DE_G_YER(-1))
|
||||
+ de_q_yed_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_DE_Q_YED ;
|
||||
[name = 'eq7']
|
||||
diff(DE_G_YER) = de_g_yer_ecm_de_q_yed_L1 * (DE_Q_YED(-1) - DE_EHIC(-1))
|
||||
+ de_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ de_g_yer_de_q_yed_L1 * diff(DE_Q_YED(-1))
|
||||
+ de_g_yer_de_g_yer_L1 * diff(DE_G_YER(-1))
|
||||
+ de_g_yer_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_DE_G_YER ;
|
||||
[name = 'eq8']
|
||||
DE_EHIC = DE_EHIC(-1) + res_DE_EHIC ;
|
||||
|
||||
|
||||
|
||||
end;
|
||||
|
||||
shocks;
|
||||
var res_U2_Q_YED = 0.005;
|
||||
var res_U2_G_YER = 0.005;
|
||||
var res_U2_STN = 0.005;
|
||||
var res_U2_ESTN = 0.005;
|
||||
var res_U2_EHIC = 0.005;
|
||||
var res_DE_Q_YED = 0.005;
|
||||
var res_DE_G_YER = 0.005;
|
||||
var res_DE_EHIC = 0.005;
|
||||
end;
|
||||
|
||||
NSIMS = 1;
|
||||
|
||||
options_.noprint = 1;
|
||||
calibrated_values = M_.params;
|
||||
verbatim;
|
||||
Sigma_e = M_.Sigma_e;
|
||||
end;
|
||||
options_.bnlms.set_dynare_seed_to_default = false;
|
||||
|
||||
nparampool = length(M_.params);
|
||||
BETA = zeros(NSIMS, nparampool);
|
||||
for i=1:NSIMS
|
||||
firstobs = rand(3, length(M_.endo_names));
|
||||
M_.params = calibrated_values;
|
||||
M_.Sigma_e = Sigma_e;
|
||||
simdata = simul_backward_model(dseries(firstobs, dates('1995Q1'), M_.endo_names), 10000);
|
||||
simdata = simdata(simdata.dates(5001:6000));
|
||||
names=regexp(simdata.name, 'res\w*');
|
||||
idxs = [];
|
||||
for j=1:length(names)
|
||||
if isempty(names{j})
|
||||
idxs = [idxs j];
|
||||
end
|
||||
end
|
||||
simdata = sur(simdata{idxs}, {}, {}, 'mymodel', true);
|
||||
BETA(i, :) = M_.params';
|
||||
oo_ = rmfield(oo_, 'sur');
|
||||
end
|
||||
|
||||
if NSIMS > 1
|
||||
if max(abs(mean(BETA)' - calibrated_values)) > 1e-2
|
||||
error(['sum(abs(mean(BETA)'' - calibrated_values)) ' num2str(sum(abs(mean(BETA)' - calibrated_values)))]);
|
||||
end
|
||||
else
|
||||
good = [-0.826686383251952
|
||||
-0.346754226737713
|
||||
0.063012625739192
|
||||
0.074803008678581
|
||||
-0.017406695286611
|
||||
-0.127075466955954
|
||||
0.025273119798253
|
||||
0.524311285013928
|
||||
-0.117653504652072
|
||||
-0.027795769946178
|
||||
-0.156599054434094
|
||||
0.054048691636616
|
||||
0.276250884768198
|
||||
1.000417819589230
|
||||
0.999336022919911
|
||||
-0.803262845969268
|
||||
-0.309598590696623
|
||||
0.051598925732525
|
||||
0.039275097813797
|
||||
0.024902442384228
|
||||
-0.096310332265968
|
||||
-0.022625946626029
|
||||
0.461672601960238
|
||||
-0.110232456667380
|
||||
1.000000000000000];
|
||||
if max(abs(BETA' - good)) > 1e-14
|
||||
error(['sum of BETA'' - good was: ' num2str(sum(abs(BETA - good)))]);
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
for i=1:nparampool
|
||||
figure
|
||||
hold on
|
||||
title(strrep(M_.param_names(i,:), '_', '\_'));
|
||||
histogram(BETA(:,i),50);
|
||||
line([calibrated_values(i) calibrated_values(i)], [0 NSIMS/10], 'LineWidth', 2, 'Color', 'r');
|
||||
hold off
|
||||
end
|
||||
|
|
|
@ -1,222 +1,222 @@
|
|||
// --+ options: json=compute +--
|
||||
|
||||
/* REMARK
|
||||
** ------
|
||||
**
|
||||
** You need to have the first line on top of the mod file. The options defined on this line are passed
|
||||
** to the dynare command (you can add other options, separated by spaces or commas). The option defined
|
||||
** here is mandatory for the decomposition. It forces Dynare to output another representation of the
|
||||
** model in JSON file (additionaly to the matlab files) which is used here to manipulate the equations.
|
||||
*/
|
||||
|
||||
var
|
||||
U2_Q_YED
|
||||
U2_G_YER
|
||||
U2_STN
|
||||
U2_ESTN
|
||||
U2_EHIC
|
||||
DE_Q_YED
|
||||
DE_G_YER
|
||||
DE_EHIC
|
||||
|
||||
;
|
||||
|
||||
varexo
|
||||
res_U2_Q_YED
|
||||
res_U2_G_YER
|
||||
res_U2_STN
|
||||
res_U2_ESTN
|
||||
res_U2_EHIC
|
||||
res_DE_Q_YED
|
||||
res_DE_G_YER
|
||||
res_DE_EHIC
|
||||
;
|
||||
|
||||
parameters
|
||||
u2_q_yed_ecm_u2_q_yed_L1
|
||||
u2_q_yed_ecm_u2_stn_L1
|
||||
u2_q_yed_u2_g_yer_L1
|
||||
u2_q_yed_u2_stn_L1
|
||||
u2_g_yer_ecm_u2_q_yed_L1
|
||||
u2_g_yer_ecm_u2_stn_L1
|
||||
u2_g_yer_u2_q_yed_L1
|
||||
u2_g_yer_u2_g_yer_L1
|
||||
u2_g_yer_u2_stn_L1
|
||||
u2_stn_ecm_u2_q_yed_L1
|
||||
u2_stn_ecm_u2_stn_L1
|
||||
u2_stn_u2_q_yed_L1
|
||||
u2_stn_u2_g_yer_L1
|
||||
u2_estn_u2_estn_L1
|
||||
u2_ehic_u2_ehic_L1
|
||||
|
||||
de_q_yed_ecm_de_q_yed_L1
|
||||
de_q_yed_ecm_u2_stn_L1
|
||||
de_q_yed_de_g_yer_L1
|
||||
de_q_yed_u2_stn_L1
|
||||
de_g_yer_ecm_de_q_yed_L1
|
||||
de_g_yer_ecm_u2_stn_L1
|
||||
de_g_yer_de_q_yed_L1
|
||||
de_g_yer_de_g_yer_L1
|
||||
de_g_yer_u2_stn_L1
|
||||
de_ehic_de_ehic_L1
|
||||
|
||||
|
||||
;
|
||||
|
||||
u2_q_yed_ecm_u2_q_yed_L1 = -0.82237516589315 ;
|
||||
u2_q_yed_ecm_u2_stn_L1 = -0.323715338568976 ;
|
||||
u2_q_yed_u2_g_yer_L1 = 0.0401361895021084 ;
|
||||
u2_q_yed_u2_stn_L1 = 0.058397703958446 ;
|
||||
u2_g_yer_ecm_u2_q_yed_L1 = 0.0189896046977421 ;
|
||||
u2_g_yer_ecm_u2_stn_L1 = -0.109597659887432 ;
|
||||
u2_g_yer_u2_q_yed_L1 = 0.0037667967632025 ;
|
||||
u2_g_yer_u2_g_yer_L1 = 0.480506381923644 ;
|
||||
u2_g_yer_u2_stn_L1 = -0.0722359286123494 ;
|
||||
u2_stn_ecm_u2_q_yed_L1 = -0.0438500662608356 ;
|
||||
u2_stn_ecm_u2_stn_L1 = -0.153283917138772 ;
|
||||
u2_stn_u2_q_yed_L1 = 0.0328744983772825 ;
|
||||
u2_stn_u2_g_yer_L1 = 0.292121949736756 ;
|
||||
u2_estn_u2_estn_L1 = 1 ;
|
||||
u2_ehic_u2_ehic_L1 = 1 ;
|
||||
|
||||
de_q_yed_ecm_de_q_yed_L1 = -0.822375165893149 ;
|
||||
de_q_yed_ecm_u2_stn_L1 = -0.323715338568977 ;
|
||||
de_q_yed_de_g_yer_L1 = 0.0401361895021082 ;
|
||||
de_q_yed_u2_stn_L1 = 0.0583977039584461 ;
|
||||
de_g_yer_ecm_de_q_yed_L1 = 0.0189896046977422 ;
|
||||
de_g_yer_ecm_u2_stn_L1 = -0.109597659887433 ;
|
||||
de_g_yer_de_q_yed_L1 = 0.00376679676320256;
|
||||
de_g_yer_de_g_yer_L1 = 0.480506381923643 ;
|
||||
de_g_yer_u2_stn_L1 = -0.0722359286123494 ;
|
||||
de_ehic_de_ehic_L1 = 1 ;
|
||||
|
||||
|
||||
model(linear);
|
||||
[name = 'eq1']
|
||||
diff(U2_Q_YED) = u2_q_yed_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_q_yed_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ u2_q_yed_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_U2_Q_YED ;
|
||||
[name = 'eq2']
|
||||
diff(U2_G_YER) = u2_g_yer_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_g_yer_u2_q_yed_L1 * diff(U2_Q_YED(-1))
|
||||
+ u2_g_yer_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ u2_g_yer_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_U2_G_YER ;
|
||||
[name = 'eq3']
|
||||
diff(U2_STN) = u2_stn_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_stn_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_stn_u2_q_yed_L1 * diff(U2_Q_YED(-1))
|
||||
+ u2_stn_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ res_U2_STN ;
|
||||
[name = 'eq4']
|
||||
U2_ESTN = u2_estn_u2_estn_L1 * U2_ESTN(-1)
|
||||
+ res_U2_ESTN ;
|
||||
[name = 'eq5']
|
||||
U2_EHIC = u2_ehic_u2_ehic_L1 * U2_EHIC(-1)
|
||||
+ res_U2_EHIC ;
|
||||
[name = 'eq6']
|
||||
diff(DE_Q_YED) = de_q_yed_ecm_de_q_yed_L1 * (DE_Q_YED(-1) - DE_EHIC(-1))
|
||||
+ de_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ de_q_yed_de_g_yer_L1 * diff(DE_G_YER(-1))
|
||||
+ de_q_yed_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_DE_Q_YED ;
|
||||
[name = 'eq7']
|
||||
diff(DE_G_YER) = de_g_yer_ecm_de_q_yed_L1 * (DE_Q_YED(-1) - DE_EHIC(-1))
|
||||
+ de_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ de_g_yer_de_q_yed_L1 * diff(DE_Q_YED(-1))
|
||||
+ de_g_yer_de_g_yer_L1 * diff(DE_G_YER(-1))
|
||||
+ de_g_yer_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_DE_G_YER ;
|
||||
[name = 'eq8']
|
||||
DE_EHIC = DE_EHIC(-1) + res_DE_EHIC ;
|
||||
|
||||
|
||||
|
||||
end;
|
||||
|
||||
shocks;
|
||||
var res_U2_Q_YED = 0.005;
|
||||
var res_U2_G_YER = 0.005;
|
||||
var res_U2_STN = 0.005;
|
||||
var res_U2_ESTN = 0.005;
|
||||
var res_U2_EHIC = 0.005;
|
||||
var res_DE_Q_YED = 0.005;
|
||||
var res_DE_G_YER = 0.005;
|
||||
var res_DE_EHIC = 0.005;
|
||||
end;
|
||||
|
||||
NSIMS = 1;
|
||||
|
||||
options_.noprint = 1;
|
||||
calibrated_values = M_.params;
|
||||
verbatim;
|
||||
Sigma_e = M_.Sigma_e;
|
||||
end;
|
||||
options_.bnlms.set_dynare_seed_to_default = false;
|
||||
|
||||
nparampool = length(M_.params);
|
||||
BETA = zeros(NSIMS, nparampool);
|
||||
for i=1:NSIMS
|
||||
firstobs = rand(3, length(M_.endo_names));
|
||||
M_.params = calibrated_values;
|
||||
M_.Sigma_e = Sigma_e;
|
||||
simdata = simul_backward_model(dseries(firstobs, dates('1995Q1'), M_.endo_names), 10000);
|
||||
simdata = simdata(simdata.dates(5001:6000));
|
||||
names=regexp(simdata.name, 'res\w*');
|
||||
idxs = [];
|
||||
for j=1:length(names)
|
||||
if isempty(names{j})
|
||||
idxs = [idxs j];
|
||||
end
|
||||
end
|
||||
simdata = sur(simdata{idxs}, {'u2_q_yed_u2_g_yer_L1', 'u2_estn_u2_estn_L1', 'u2_ehic_u2_ehic_L1', 'de_q_yed_de_g_yer_L1', 'u2_g_yer_u2_g_yer_L1', 'u2_stn_u2_q_yed_L1', 'u2_q_yed_ecm_u2_q_yed_L1', 'de_g_yer_u2_stn_L1'}, {}, 'mymodel', true);
|
||||
BETA(i, :) = M_.params';
|
||||
oo_ = rmfield(oo_, 'sur');
|
||||
end
|
||||
if NSIMS > 1
|
||||
if max(abs(mean(BETA)' - calibrated_values)) > 1e-2
|
||||
error(['sum(abs(mean(BETA)'' - calibrated_values)) ' num2str(sum(abs(mean(BETA)' - calibrated_values)))]);
|
||||
end
|
||||
else
|
||||
good = [-0.811559435201128
|
||||
-0.323715338568976
|
||||
0.073666282610569
|
||||
0.058397703958446
|
||||
0.018989604697742
|
||||
-0.109597659887432
|
||||
0.003766796763203
|
||||
0.510389966839712
|
||||
-0.072235928612349
|
||||
-0.043850066260836
|
||||
-0.153283917138772
|
||||
0.058739144948151
|
||||
0.292121949736756
|
||||
1.000413662363949
|
||||
0.999337514406012
|
||||
-0.822375165893149
|
||||
-0.323715338568977
|
||||
0.046096335070402
|
||||
0.058397703958446
|
||||
0.018989604697742
|
||||
-0.109597659887433
|
||||
0.003766796763203
|
||||
0.480506381923643
|
||||
-0.111002148299648
|
||||
1.000000000000000];
|
||||
if max(abs(BETA' - good)) > 1e-14
|
||||
error(['sum of BETA'' - good was: ' num2str(sum(abs(BETA - good)))]);
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
for i=1:nparampool
|
||||
figure
|
||||
hold on
|
||||
title(strrep(M_.param_names(i,:), '_', '\_'));
|
||||
histogram(BETA(:,i),50);
|
||||
line([calibrated_values(i) calibrated_values(i)], [0 NSIMS/10], 'LineWidth', 2, 'Color', 'r');
|
||||
hold off
|
||||
end
|
||||
// --+ options: json=compute +--
|
||||
|
||||
/* REMARK
|
||||
** ------
|
||||
**
|
||||
** You need to have the first line on top of the mod file. The options defined on this line are passed
|
||||
** to the dynare command (you can add other options, separated by spaces or commas). The option defined
|
||||
** here is mandatory for the decomposition. It forces Dynare to output another representation of the
|
||||
** model in JSON file (additionaly to the matlab files) which is used here to manipulate the equations.
|
||||
*/
|
||||
|
||||
var
|
||||
U2_Q_YED
|
||||
U2_G_YER
|
||||
U2_STN
|
||||
U2_ESTN
|
||||
U2_EHIC
|
||||
DE_Q_YED
|
||||
DE_G_YER
|
||||
DE_EHIC
|
||||
|
||||
;
|
||||
|
||||
varexo
|
||||
res_U2_Q_YED
|
||||
res_U2_G_YER
|
||||
res_U2_STN
|
||||
res_U2_ESTN
|
||||
res_U2_EHIC
|
||||
res_DE_Q_YED
|
||||
res_DE_G_YER
|
||||
res_DE_EHIC
|
||||
;
|
||||
|
||||
parameters
|
||||
u2_q_yed_ecm_u2_q_yed_L1
|
||||
u2_q_yed_ecm_u2_stn_L1
|
||||
u2_q_yed_u2_g_yer_L1
|
||||
u2_q_yed_u2_stn_L1
|
||||
u2_g_yer_ecm_u2_q_yed_L1
|
||||
u2_g_yer_ecm_u2_stn_L1
|
||||
u2_g_yer_u2_q_yed_L1
|
||||
u2_g_yer_u2_g_yer_L1
|
||||
u2_g_yer_u2_stn_L1
|
||||
u2_stn_ecm_u2_q_yed_L1
|
||||
u2_stn_ecm_u2_stn_L1
|
||||
u2_stn_u2_q_yed_L1
|
||||
u2_stn_u2_g_yer_L1
|
||||
u2_estn_u2_estn_L1
|
||||
u2_ehic_u2_ehic_L1
|
||||
|
||||
de_q_yed_ecm_de_q_yed_L1
|
||||
de_q_yed_ecm_u2_stn_L1
|
||||
de_q_yed_de_g_yer_L1
|
||||
de_q_yed_u2_stn_L1
|
||||
de_g_yer_ecm_de_q_yed_L1
|
||||
de_g_yer_ecm_u2_stn_L1
|
||||
de_g_yer_de_q_yed_L1
|
||||
de_g_yer_de_g_yer_L1
|
||||
de_g_yer_u2_stn_L1
|
||||
de_ehic_de_ehic_L1
|
||||
|
||||
|
||||
;
|
||||
|
||||
u2_q_yed_ecm_u2_q_yed_L1 = -0.82237516589315 ;
|
||||
u2_q_yed_ecm_u2_stn_L1 = -0.323715338568976 ;
|
||||
u2_q_yed_u2_g_yer_L1 = 0.0401361895021084 ;
|
||||
u2_q_yed_u2_stn_L1 = 0.058397703958446 ;
|
||||
u2_g_yer_ecm_u2_q_yed_L1 = 0.0189896046977421 ;
|
||||
u2_g_yer_ecm_u2_stn_L1 = -0.109597659887432 ;
|
||||
u2_g_yer_u2_q_yed_L1 = 0.0037667967632025 ;
|
||||
u2_g_yer_u2_g_yer_L1 = 0.480506381923644 ;
|
||||
u2_g_yer_u2_stn_L1 = -0.0722359286123494 ;
|
||||
u2_stn_ecm_u2_q_yed_L1 = -0.0438500662608356 ;
|
||||
u2_stn_ecm_u2_stn_L1 = -0.153283917138772 ;
|
||||
u2_stn_u2_q_yed_L1 = 0.0328744983772825 ;
|
||||
u2_stn_u2_g_yer_L1 = 0.292121949736756 ;
|
||||
u2_estn_u2_estn_L1 = 1 ;
|
||||
u2_ehic_u2_ehic_L1 = 1 ;
|
||||
|
||||
de_q_yed_ecm_de_q_yed_L1 = -0.822375165893149 ;
|
||||
de_q_yed_ecm_u2_stn_L1 = -0.323715338568977 ;
|
||||
de_q_yed_de_g_yer_L1 = 0.0401361895021082 ;
|
||||
de_q_yed_u2_stn_L1 = 0.0583977039584461 ;
|
||||
de_g_yer_ecm_de_q_yed_L1 = 0.0189896046977422 ;
|
||||
de_g_yer_ecm_u2_stn_L1 = -0.109597659887433 ;
|
||||
de_g_yer_de_q_yed_L1 = 0.00376679676320256;
|
||||
de_g_yer_de_g_yer_L1 = 0.480506381923643 ;
|
||||
de_g_yer_u2_stn_L1 = -0.0722359286123494 ;
|
||||
de_ehic_de_ehic_L1 = 1 ;
|
||||
|
||||
|
||||
model(linear);
|
||||
[name = 'eq1']
|
||||
diff(U2_Q_YED) = u2_q_yed_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_q_yed_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ u2_q_yed_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_U2_Q_YED ;
|
||||
[name = 'eq2']
|
||||
diff(U2_G_YER) = u2_g_yer_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_g_yer_u2_q_yed_L1 * diff(U2_Q_YED(-1))
|
||||
+ u2_g_yer_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ u2_g_yer_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_U2_G_YER ;
|
||||
[name = 'eq3']
|
||||
diff(U2_STN) = u2_stn_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1))
|
||||
+ u2_stn_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ u2_stn_u2_q_yed_L1 * diff(U2_Q_YED(-1))
|
||||
+ u2_stn_u2_g_yer_L1 * diff(U2_G_YER(-1))
|
||||
+ res_U2_STN ;
|
||||
[name = 'eq4']
|
||||
U2_ESTN = u2_estn_u2_estn_L1 * U2_ESTN(-1)
|
||||
+ res_U2_ESTN ;
|
||||
[name = 'eq5']
|
||||
U2_EHIC = u2_ehic_u2_ehic_L1 * U2_EHIC(-1)
|
||||
+ res_U2_EHIC ;
|
||||
[name = 'eq6']
|
||||
diff(DE_Q_YED) = de_q_yed_ecm_de_q_yed_L1 * (DE_Q_YED(-1) - DE_EHIC(-1))
|
||||
+ de_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ de_q_yed_de_g_yer_L1 * diff(DE_G_YER(-1))
|
||||
+ de_q_yed_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_DE_Q_YED ;
|
||||
[name = 'eq7']
|
||||
diff(DE_G_YER) = de_g_yer_ecm_de_q_yed_L1 * (DE_Q_YED(-1) - DE_EHIC(-1))
|
||||
+ de_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1))
|
||||
+ de_g_yer_de_q_yed_L1 * diff(DE_Q_YED(-1))
|
||||
+ de_g_yer_de_g_yer_L1 * diff(DE_G_YER(-1))
|
||||
+ de_g_yer_u2_stn_L1 * diff(U2_STN(-1))
|
||||
+ res_DE_G_YER ;
|
||||
[name = 'eq8']
|
||||
DE_EHIC = DE_EHIC(-1) + res_DE_EHIC ;
|
||||
|
||||
|
||||
|
||||
end;
|
||||
|
||||
shocks;
|
||||
var res_U2_Q_YED = 0.005;
|
||||
var res_U2_G_YER = 0.005;
|
||||
var res_U2_STN = 0.005;
|
||||
var res_U2_ESTN = 0.005;
|
||||
var res_U2_EHIC = 0.005;
|
||||
var res_DE_Q_YED = 0.005;
|
||||
var res_DE_G_YER = 0.005;
|
||||
var res_DE_EHIC = 0.005;
|
||||
end;
|
||||
|
||||
NSIMS = 1;
|
||||
|
||||
options_.noprint = 1;
|
||||
calibrated_values = M_.params;
|
||||
verbatim;
|
||||
Sigma_e = M_.Sigma_e;
|
||||
end;
|
||||
options_.bnlms.set_dynare_seed_to_default = false;
|
||||
|
||||
nparampool = length(M_.params);
|
||||
BETA = zeros(NSIMS, nparampool);
|
||||
for i=1:NSIMS
|
||||
firstobs = rand(3, length(M_.endo_names));
|
||||
M_.params = calibrated_values;
|
||||
M_.Sigma_e = Sigma_e;
|
||||
simdata = simul_backward_model(dseries(firstobs, dates('1995Q1'), M_.endo_names), 10000);
|
||||
simdata = simdata(simdata.dates(5001:6000));
|
||||
names=regexp(simdata.name, 'res\w*');
|
||||
idxs = [];
|
||||
for j=1:length(names)
|
||||
if isempty(names{j})
|
||||
idxs = [idxs j];
|
||||
end
|
||||
end
|
||||
simdata = sur(simdata{idxs}, {'u2_q_yed_u2_g_yer_L1', 'u2_estn_u2_estn_L1', 'u2_ehic_u2_ehic_L1', 'de_q_yed_de_g_yer_L1', 'u2_g_yer_u2_g_yer_L1', 'u2_stn_u2_q_yed_L1', 'u2_q_yed_ecm_u2_q_yed_L1', 'de_g_yer_u2_stn_L1'}, {}, 'mymodel', true);
|
||||
BETA(i, :) = M_.params';
|
||||
oo_ = rmfield(oo_, 'sur');
|
||||
end
|
||||
if NSIMS > 1
|
||||
if max(abs(mean(BETA)' - calibrated_values)) > 1e-2
|
||||
error(['sum(abs(mean(BETA)'' - calibrated_values)) ' num2str(sum(abs(mean(BETA)' - calibrated_values)))]);
|
||||
end
|
||||
else
|
||||
good = [-0.811559435201128
|
||||
-0.323715338568976
|
||||
0.073666282610569
|
||||
0.058397703958446
|
||||
0.018989604697742
|
||||
-0.109597659887432
|
||||
0.003766796763203
|
||||
0.510389966839712
|
||||
-0.072235928612349
|
||||
-0.043850066260836
|
||||
-0.153283917138772
|
||||
0.058739144948151
|
||||
0.292121949736756
|
||||
1.000413662363949
|
||||
0.999337514406012
|
||||
-0.822375165893149
|
||||
-0.323715338568977
|
||||
0.046096335070402
|
||||
0.058397703958446
|
||||
0.018989604697742
|
||||
-0.109597659887433
|
||||
0.003766796763203
|
||||
0.480506381923643
|
||||
-0.111002148299648
|
||||
1.000000000000000];
|
||||
if max(abs(BETA' - good)) > 1e-14
|
||||
error(['sum of BETA'' - good was: ' num2str(sum(abs(BETA - good)))]);
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
for i=1:nparampool
|
||||
figure
|
||||
hold on
|
||||
title(strrep(M_.param_names(i,:), '_', '\_'));
|
||||
histogram(BETA(:,i),50);
|
||||
line([calibrated_values(i) calibrated_values(i)], [0 NSIMS/10], 'LineWidth', 2, 'Color', 'r');
|
||||
hold off
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue