Added integration tests (for constrained OLS).
parent
bbf437bebd
commit
0d5b310207
|
@ -416,6 +416,9 @@ MODFILES = \
|
||||||
pac/trend-component-17/example.mod \
|
pac/trend-component-17/example.mod \
|
||||||
pac/trend-component-18/example.mod \
|
pac/trend-component-18/example.mod \
|
||||||
estimation/univariate/bayesian.mod \
|
estimation/univariate/bayesian.mod \
|
||||||
|
estimation/univariate/ols/ols.mod \
|
||||||
|
estimation/univariate/ols/ols_wc_1.mod \
|
||||||
|
estimation/univariate/ols/ols_wc_2.mod \
|
||||||
dynare-command-options/ramst.mod
|
dynare-command-options/ramst.mod
|
||||||
|
|
||||||
PARTICLEFILES = \
|
PARTICLEFILES = \
|
||||||
|
@ -811,6 +814,10 @@ var-expectations: m/var-expectations o/var-expectations
|
||||||
m/var-expectations: $(patsubst %.mod, %.m.trs, $(filter var-expectations/%.mod, $(MODFILES)))
|
m/var-expectations: $(patsubst %.mod, %.m.trs, $(filter var-expectations/%.mod, $(MODFILES)))
|
||||||
o/var-expectations: $(patsubst %.mod, %.o.trs, $(filter var-expectations/%.mod, $(MODFILES)))
|
o/var-expectations: $(patsubst %.mod, %.o.trs, $(filter var-expectations/%.mod, $(MODFILES)))
|
||||||
|
|
||||||
|
estimation/univariate/ols: m/estimation/univariate/ols o/estimation/univariate/ols
|
||||||
|
m/estimation/univariate/ols: $(patsubst %.mod, %.m.trs, $(filter estimation/univariate/ols/%.mod, $(MODFILES)))
|
||||||
|
o/estimation/univariate/ols: $(patsubst %.mod, %.o.trs, $(filter estimation/univariate/ols/%.mod, $(MODFILES)))
|
||||||
|
|
||||||
trend-component-and-var-models: m/trend-component-and-var-models o/trend-component-and-var-models
|
trend-component-and-var-models: m/trend-component-and-var-models o/trend-component-and-var-models
|
||||||
m/trend-component-and-var-models: $(patsubst %.mod, %.m.trs, $(filter trend-component-and-var-models/%.mod, $(MODFILES)))
|
m/trend-component-and-var-models: $(patsubst %.mod, %.m.trs, $(filter trend-component-and-var-models/%.mod, $(MODFILES)))
|
||||||
o/trend-component-and-var-models: $(patsubst %.mod, %.o.trs, $(filter trend-component-and-var-models/%.mod, $(MODFILES)))
|
o/trend-component-and-var-models: $(patsubst %.mod, %.o.trs, $(filter trend-component-and-var-models/%.mod, $(MODFILES)))
|
||||||
|
@ -943,6 +950,7 @@ EXTRA_DIST = \
|
||||||
optimizers/fs2000.common.inc \
|
optimizers/fs2000.common.inc \
|
||||||
estimation/MH_recover/fs2000.common.inc \
|
estimation/MH_recover/fs2000.common.inc \
|
||||||
estimation/univariate/data.csv \
|
estimation/univariate/data.csv \
|
||||||
|
estimation/univariate/ols/mc-ols.inc \
|
||||||
prior_posterior_function/posterior_function_demo.m
|
prior_posterior_function/posterior_function_demo.m
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
verbatim;
|
||||||
|
|
||||||
|
options_.noprint = true;
|
||||||
|
|
||||||
|
number_of_simulations = 1000;
|
||||||
|
|
||||||
|
calibrated_values = M_.params;
|
||||||
|
Sigma_e = M_.Sigma_e;
|
||||||
|
|
||||||
|
options_.bnlms.set_dynare_seed_to_default = false;
|
||||||
|
|
||||||
|
Beta = zeros(number_of_simulations, M_.param_nbr);
|
||||||
|
|
||||||
|
for i=1:number_of_simulations
|
||||||
|
% Set initial conditions randomly
|
||||||
|
firstobs = rand(3, length(M_.endo_names));
|
||||||
|
% Set parameters to calibrated values (because after the
|
||||||
|
% estimation parameters in equation 7 are updated with OLS
|
||||||
|
% estimator).
|
||||||
|
M_.params = calibrated_values;
|
||||||
|
M_.Sigma_e = Sigma_e;
|
||||||
|
% Simulate the model.
|
||||||
|
simdata = simul_backward_model(dseries(firstobs, dates('1995Q1'), M_.endo_names), 1100);
|
||||||
|
% Select a subsample.
|
||||||
|
simdata = simdata(simdata.dates(101:1100));
|
||||||
|
% Get vector of indices to exclude exogenous variables from the dataset.
|
||||||
|
names = regexp(simdata.name, 'res\w*');
|
||||||
|
idxs = find(cellfun(@isempty, names));
|
||||||
|
% Perform the estimation of equation 7.
|
||||||
|
dyn_ols(simdata{idxs}, {}, {'eq7'});
|
||||||
|
% Store the estimation results in Beta
|
||||||
|
Beta(i, :) = M_.params';
|
||||||
|
end
|
||||||
|
|
||||||
|
% Get the indices of the estimated parameters
|
||||||
|
pid = oo_.ols.eq7.param_idxs;
|
||||||
|
|
||||||
|
for i=1:length(pid)
|
||||||
|
figure(i)
|
||||||
|
hold on
|
||||||
|
title(strrep(M_.param_names(pid(i),:), '_', '\_'));
|
||||||
|
bandwidth = mh_optimal_bandwidth(Beta(:,pid(i)), length(Beta(:,pid(i))), -1, 'gaussian');
|
||||||
|
[abscissa, f] = kernel_density_estimate(Beta(:,pid(i)), 256, length(Beta(:,pid(i))), bandwidth, 'gaussian');
|
||||||
|
plot(abscissa, f, '-k', 'linewidth', 2);
|
||||||
|
line([calibrated_values(pid(i)) calibrated_values(pid(i))], [0 max(f)*1.05], 'LineWidth', 2, 'Color', 'r');
|
||||||
|
line([mean(Beta(:,pid(i))) mean(Beta(:,pid(i)))], [0 max(f)*1.05], 'LineWidth', 2, 'Color', 'g');
|
||||||
|
axis tight
|
||||||
|
box on
|
||||||
|
hold off
|
||||||
|
end
|
||||||
|
|
||||||
|
if max(abs(calibrated_values(pid)-mean(Beta(:,pid)', 2)))>1e-2
|
||||||
|
error('There is probably an error in the OLS routine.')
|
||||||
|
end
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
|
@ -148,3 +148,5 @@ var res_DE_Q_YED = 0.005;
|
||||||
var res_DE_G_YER = 0.005;
|
var res_DE_G_YER = 0.005;
|
||||||
var res_DE_EHIC = 0.005;
|
var res_DE_EHIC = 0.005;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@#include "mc-ols.inc"
|
|
@ -0,0 +1,149 @@
|
||||||
|
// --+ options: json=compute nopreprocessoroutput stochastic +--
|
||||||
|
|
||||||
|
/* REMARK
|
||||||
|
** ------
|
||||||
|
**
|
||||||
|
** You need to have the first line on top of the mod file. The options defined on this line are passed
|
||||||
|
f** 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_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_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))
|
||||||
|
+ (1-de_g_yer_de_q_yed_L1-de_g_yer_de_g_yer_L1)* diff(U2_STN(-1))
|
||||||
|
+ res_DE_G_YER ;
|
||||||
|
[name = 'eq8']
|
||||||
|
DE_EHIC = de_ehic_de_ehic_L1 * 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;
|
||||||
|
|
||||||
|
@#include "mc-ols.inc"
|
|
@ -0,0 +1,152 @@
|
||||||
|
// --+ options: json=compute nopreprocessoroutput stochastic +--
|
||||||
|
|
||||||
|
/* REMARK
|
||||||
|
** ------
|
||||||
|
**
|
||||||
|
** You need to have the first line on top of the mod file. The options defined on this line are passed
|
||||||
|
f** 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_ehic_de_ehic_L1
|
||||||
|
p
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
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_ehic_de_ehic_L1 = 1 ;
|
||||||
|
|
||||||
|
p = 0;
|
||||||
|
|
||||||
|
|
||||||
|
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))
|
||||||
|
+ (p-de_g_yer_de_q_yed_L1) * diff(U2_STN(-1))
|
||||||
|
+ res_DE_G_YER ;
|
||||||
|
[name = 'eq8']
|
||||||
|
DE_EHIC = de_ehic_de_ehic_L1 * 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;
|
||||||
|
|
||||||
|
@#include "mc-ols.inc"
|
|
@ -1,52 +0,0 @@
|
||||||
close all
|
|
||||||
|
|
||||||
dynare ols.mod;
|
|
||||||
|
|
||||||
global M_ options_ oo_
|
|
||||||
|
|
||||||
|
|
||||||
options_.noprint = true;
|
|
||||||
|
|
||||||
number_of_simulations = 1000;
|
|
||||||
|
|
||||||
calibrated_values = M_.params;
|
|
||||||
Sigma_e = M_.Sigma_e;
|
|
||||||
|
|
||||||
options_.bnlms.set_dynare_seed_to_default = false;
|
|
||||||
|
|
||||||
Beta = zeros(number_of_simulations, M_.param_nbr);
|
|
||||||
|
|
||||||
for i=1:number_of_simulations
|
|
||||||
% Set initial conditions randomly
|
|
||||||
firstobs = rand(3, length(M_.endo_names));
|
|
||||||
% Set parameters to calibrated values (because after the
|
|
||||||
% estimation parameters in equation 7 are updated with OLS
|
|
||||||
% estimator).
|
|
||||||
M_.params = calibrated_values;
|
|
||||||
M_.Sigma_e = Sigma_e;
|
|
||||||
% Simulate the model.
|
|
||||||
simdata = simul_backward_model(dseries(firstobs, dates('1995Q1'), M_.endo_names), 10000);
|
|
||||||
% Select a subsample.
|
|
||||||
simdata = simdata(simdata.dates(5001:6000));
|
|
||||||
% Perform the estimation of equation 7.
|
|
||||||
names = regexp(simdata.name, 'res\w*');
|
|
||||||
idxs = find(cellfun(@isempty, names));
|
|
||||||
dyn_ols(simdata{idxs}, {}, {'eq7'});
|
|
||||||
% Store the estimation results in Beta
|
|
||||||
Beta(i, :) = M_.params';
|
|
||||||
end
|
|
||||||
|
|
||||||
pid = oo_.ols.eq7.param_idxs;
|
|
||||||
|
|
||||||
for i=1:length(pid)
|
|
||||||
figure(i)
|
|
||||||
hold on
|
|
||||||
title(strrep(M_.param_names(pid(i),:), '_', '\_'));
|
|
||||||
bandwidth = mh_optimal_bandwidth(Beta(:,pid(i)), length(Beta(:,pid(i))), -1, 'gaussian');
|
|
||||||
[abscissa, f] = kernel_density_estimate(Beta(:,pid(i)), 256, length(Beta(:,pid(i))), bandwidth, 'gaussian');
|
|
||||||
plot(abscissa, f, '-k', 'linewidth', 2);
|
|
||||||
line([calibrated_values(pid(i)) calibrated_values(pid(i))], [0 max(f)*1.05], 'LineWidth', 2, 'Color', 'r');
|
|
||||||
axis tight
|
|
||||||
box on
|
|
||||||
hold off
|
|
||||||
end
|
|
Loading…
Reference in New Issue