update tests

time-shift
Houtan Bastani 2019-03-04 11:15:45 +01:00
parent 01c5d2a90c
commit 59ab4f4b34
No known key found for this signature in database
GPG Key ID: 000094FB955BE169
7 changed files with 219 additions and 163 deletions

View File

@ -437,16 +437,17 @@ MODFILES = \
dynare-command-options/ramst.mod dynare-command-options/ramst.mod
OLS_MODFILES = \ OLS_MODFILES = \
estimation/univariate/bayesian.mod \
ecb/SURGibbs/fulton_fish.mod \
estimation/univariate/ols/ols_wc_1.mod \
estimation/univariate/ols/ols_wc_2.mod \
estimation/univariate/ols/ols.mod \
ecb/SUR/sur_noninteractive.mod \ ecb/SUR/sur_noninteractive.mod \
ecb/SUR/panel_var_diff_NB_simulation_test.mod \ ecb/SUR/panel_var_diff_NB_simulation_test.mod \
ecb/SUR/panel_var_diff_NB_simulation_zero_eq.mod \ ecb/SUR/panel_var_diff_NB_simulation_zero_eq.mod \
ecb/pooled_ols/panel_var_diff_NB_simulation_test.mod \ ecb/pooled_ols/panel_var_diff_NB_simulation_test.mod \
ecb/pooled_fgls/panel_var_diff_NB_simulation_test.mod \ ecb/pooled_fgls/panel_var_diff_NB_simulation_test.mod
estimation/univariate/bayesian.mod \
estimation/univariate/ols/ols_wc_1.mod \
estimation/univariate/ols/ols_wc_2.mod \
estimation/univariate/ols/ols.mod \
ecb/SURGibbs/fulton_fish.mod
MODFILES += $(OLS_MODFILES) MODFILES += $(OLS_MODFILES)

View File

@ -148,14 +148,13 @@ var res_DE_G_YER = 0.005;
var res_DE_EHIC = 0.005; var res_DE_EHIC = 0.005;
end; end;
NSIMS = 1000; NSIMS = 1;
options_.noprint = 1; options_.noprint = 1;
calibrated_values = M_.params; calibrated_values = M_.params;
verbatim; verbatim;
Sigma_e = M_.Sigma_e; Sigma_e = M_.Sigma_e;
end; end;
assert(NSIMS > 1);
options_.bnlms.set_dynare_seed_to_default = false; options_.bnlms.set_dynare_seed_to_default = false;
nparampool = length(M_.params); nparampool = length(M_.params);
@ -175,36 +174,43 @@ for i=1:NSIMS
end end
sur(simdata{idxs}); sur(simdata{idxs});
BETA(i, :) = M_.params'; BETA(i, :) = M_.params';
oo_ = rmfield(oo_, 'sur');
end end
tmp = mean(BETA)' - calibrated_values; if NSIMS > 1
good = [-0.000851206009290 if max(abs(mean(BETA)' - calibrated_values)) > 1e-2
-0.000643198850342 error(['sum(abs(mean(BETA)'' - calibrated_values)) ' num2str(sum(abs(mean(BETA)' - calibrated_values)))]);
-0.000077654636303 end
-0.000420898437454 else
0.000262557551524 good = [-0.826686196809409
-0.000245111192739 -0.346753563700393
-0.000076643809917 0.063013991583949
-0.001731735812364 0.074802596658698
-0.001143888514328 -0.017440119721953
0.000121014793695 -0.127090614348862
-0.000577022127737 0.025293280404460
-0.000749730989778 0.524290302468866
-0.000277999433209 -0.117611206771440
-0.000622189775653 -0.027776224547132
-0.000635550804554 -0.156590828735908
-0.000249226746560 0.054039707976331
-0.000444130561721 0.276257666502046
-0.000186765256265 1.000417289621684
-0.000441923342534 0.999336865129450
-0.000014925384893 -0.803258152338916
0.000091140073668 -0.309594948488168
-0.000237339805772 0.051602756230521
-0.000838249050874 0.039275481081030
0.000815931859253 0.024897596371662
0]; -0.096310133845385
if sum(abs(tmp-good)) > 1e-14 -0.022630284059365
error(['sum of tmp - good was: ' num2str(sum(abs(tmp-good)))]); 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 end
for i=1:nparampool for i=1:nparampool

View File

@ -144,7 +144,7 @@ var res_DE_G_YER = 0.005;
var res_DE_EHIC = 0.005; var res_DE_EHIC = 0.005;
end; end;
NSIMS = 1000; NSIMS = 1;
options_.noprint = 1; options_.noprint = 1;
calibrated_values = M_.params; calibrated_values = M_.params;
@ -173,42 +173,43 @@ for i=1:NSIMS
end end
sur(simdata{idxs}); sur(simdata{idxs});
BETA(i, :) = M_.params'; BETA(i, :) = M_.params';
oo_ = rmfield(oo_, 'sur');
end end
if size(BETA',2) == 1 if NSIMS > 1
tmp = BETA' - calibrated_values; 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 else
tmp = mean(BETA)' - calibrated_values; good = [-0.806260229719792
end -0.354371215026078
0.067618717060638
good = [-0.003887531498207 0.088053231576354
-0.002565330545918 -0.057161898696690
-0.000239567336676 -0.136999143481575
0.003408443512070 0.052047088887385
0.001553818170767 0.524022502978068
-0.000469903487876 -0.110211572532150
-0.001112844922537 -0.041415758049800
-0.003118147971245 -0.162997606880957
0.000781155700883 0.091000830792721
-0.000803694625262 0.281196660545012
-0.002236638387246 1.000000000000000
-0.000683200861198 1.000000000000000
-0.000310394894060 -0.823354793011220
0 -0.337521089381118
0 0.025493177305917
-0.000086918837962 0.059513905441361
-0.000383472263486 0.016845886773011
0.000820117983637 -0.151537340795868
0.000953382489529 0.004832174649536
0.000989541137148 0.430883913061161
-0.001083720105374 -0.071743697511067
-0.000359301045695 1.000000000000000];
-0.001656187747193 if max(abs(BETA' - good)) > 1e-14
0.000462206249631 error(['sum of BETA'' - good was: ' num2str(sum(abs(BETA - good)))]);
0]; end
return
if sum(abs(tmp-good)) > 1e-14
error(['sum of tmp - good was: ' num2str(sum(abs(tmp-good)))]);
end end
for i=1:nparampool for i=1:nparampool

View File

@ -148,14 +148,13 @@ var res_DE_G_YER = 0.005;
var res_DE_EHIC = 0.005; var res_DE_EHIC = 0.005;
end; end;
NSIMS = 1000; NSIMS = 1;
options_.noprint = 1; options_.noprint = 1;
calibrated_values = M_.params; calibrated_values = M_.params;
verbatim; verbatim;
Sigma_e = M_.Sigma_e; Sigma_e = M_.Sigma_e;
end; end;
assert(NSIMS > 1);
options_.bnlms.set_dynare_seed_to_default = false; options_.bnlms.set_dynare_seed_to_default = false;
nparampool = length(M_.params); nparampool = length(M_.params);
@ -175,36 +174,43 @@ for i=1:NSIMS
end end
sur(simdata{idxs}, {}, {}, 'mymodel', true); sur(simdata{idxs}, {}, {}, 'mymodel', true);
BETA(i, :) = M_.params'; BETA(i, :) = M_.params';
oo_ = rmfield(oo_, 'sur');
end end
tmp = mean(BETA)' - calibrated_values; if NSIMS > 1
good = [-0.000851256219733 if max(abs(mean(BETA)' - calibrated_values)) > 1e-2
-0.000643255670073 error(['sum(abs(mean(BETA)'' - calibrated_values)) ' num2str(sum(abs(mean(BETA)' - calibrated_values)))]);
-0.000078774226193 end
-0.000420026410496 else
0.000262319820667 good = [-0.826686383251952
-0.000245434738588 -0.346754226737713
-0.000076193984629 0.063012625739192
-0.001732502219600 0.074803008678581
-0.001142802053612 -0.017406695286611
0.000120684867379 -0.127075466955954
-0.000577323101449 0.025273119798253
-0.000750502207473 0.524311285013928
-0.000277709424315 -0.117653504652072
-0.000622119904600 -0.027795769946178
-0.000635564841533 -0.156599054434094
-0.000249342272071 0.054048691636616
-0.000443999454424 0.276250884768198
-0.000187590389264 1.000417819589230
-0.000441672489341 0.999336022919911
-0.000015259855753 -0.803262845969268
0.000091236076295 -0.309598590696623
-0.000236028177813 0.051598925732525
-0.000838101091676 0.039275097813797
0.000815800740293 0.024902442384228
0]; -0.096310332265968
if sum(abs(tmp-good)) > 1e-14 -0.022625946626029
error(['sum of tmp - good was: ' num2str(sum(abs(tmp-good)))]); 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 end
for i=1:nparampool for i=1:nparampool

View File

@ -149,7 +149,7 @@ var res_DE_G_YER = 0.005;
var res_DE_EHIC = 0.005; var res_DE_EHIC = 0.005;
end; end;
NSIMS = 1000; NSIMS = 1;
calibrated_values = M_.params; calibrated_values = M_.params;
verbatim; verbatim;
@ -186,36 +186,43 @@ for i=1:NSIMS
'*_g_yer_u2_stn_L1', ... '*_g_yer_u2_stn_L1', ...
'*_ehic_*_ehic_L1'}); '*_ehic_*_ehic_L1'});
BETA(i, :) = M_.params'; BETA(i, :) = M_.params';
oo_ = rmfield(oo_, 'pooled_fgls');
end end
tmp = mean(BETA)' - calibrated_values; if NSIMS > 1
good = [-0.117180965691355 if sum(abs(mean(BETA)' - calibrated_values)) > 1e-2
-0.416020161883635 error(['sum(abs(mean(BETA)'' - calibrated_values)) ' num2str(sum(abs(mean(BETA)' - calibrated_values)))]);
-0.163402818556098 end
-0.590340328553228 else
0.146701546733206 good = [-0.814463611096955
0.095280068863474 -0.327545854281441
-0.110518319499523 0.058155751549620
-0.281212762467509 0.056956172127541
-0.387430919215850 0.004760467203543
0.148014899155655 -0.110209140210870
-0.582272479386248 0.000873625473015
-0.768003006461973 0.492984603730353
-0.280750812328145 -0.110739844810764
-0.622414692972750 -0.026953553332579
-0.213383844465564 -0.155433250333810
-0.117180965692354 0.053391289583053
-0.416020161882635 0.275361374992940
-0.163402818555897 1.000446511792020
-0.590340328553332 0.999278815424852
0.146701546733106 -0.814463611096955
0.095280068864473 -0.327545854281441
-0.110518319499583 0.058155751549620
-0.281212762466510 0.056956172127541
-0.387430919215850 0.004760467203543
-0.213383844465564]*1.0e-03; -0.110209140210870
if sum(abs(tmp-good)) > 1e-14 0.000873625473015
error(['sum of tmp - good was: ' num2str(sum(abs(tmp-good)))]); 0.492984603730353
-0.110739844810764
0.999278815424852];
if max(abs(BETA' - good)) > 1e-14
error(['sum of BETA'' - good was: ' num2str(sum(abs(BETA - good)))]);
end
return
end end
for i=1:nparampool for i=1:nparampool

View File

@ -149,7 +149,7 @@ var res_DE_G_YER = 0.005;
var res_DE_EHIC = 0.005; var res_DE_EHIC = 0.005;
end; end;
NSIMS = 1000; NSIMS = 1;
calibrated_values = M_.params; calibrated_values = M_.params;
verbatim; verbatim;
@ -186,36 +186,43 @@ for i=1:NSIMS
'*_g_yer_u2_stn_L1', ... '*_g_yer_u2_stn_L1', ...
'*_ehic_*_ehic_L1'}); '*_ehic_*_ehic_L1'});
BETA(i, :) = M_.params'; BETA(i, :) = M_.params';
oo_ = rmfield(oo_, 'pooled_ols');
end end
tmp = mean(BETA)' - calibrated_values; if NSIMS > 1
good = [-0.075732742267465 if sum(abs(mean(BETA)' - calibrated_values)) > 1e-2
-0.399406249294632 error(['sum(abs(mean(BETA)'' - calibrated_values)) ' num2str(sum(abs(mean(BETA)' - calibrated_values)))]);
-0.234792967895359 end
-0.588970916491835 else
0.067498492395235 good = [-0.814685080218300
0.063450881343338 -0.327809964140588
-0.039680797111538 0.058359966460475
-0.305307448765335 0.056151094599907
-0.347337705286735 0.004707755717058
0.094723439006586 -0.110288651670160
-0.576221284678741 0.000910770641800
-0.789746631585334 0.494342669441397
-0.264217514455656 -0.109455922483561
-0.620788021980068 -0.029329632163194
-0.213308690451885 -0.157236653586389
-0.075732742268464 0.054467548349538
-0.399406249293632 0.275969658826900
-0.234792967895157 1.000451016087141
-0.588970916491939 0.999236021952814
0.067498492395134 -0.814685080218300
0.063450881344337 -0.327809964140588
-0.039680797111598 0.058359966460475
-0.305307448764336 0.056151094599907
-0.347337705286735 0.004707755717058
-0.213308690451885]*1.0e-03; -0.110288651670160
if sum(abs(tmp-good)) > 1e-14 0.000910770641800
error(['sum of tmp - good was: ' num2str(sum(abs(tmp-good)))]); 0.494342669441397
-0.109455922483561
0.999236021952814];
if max(abs(BETA' - good)) > 1e-14
error(['sum of BETA'' - good was: ' num2str(sum(abs(BETA - good)))]);
end
return
end end
for i=1:nparampool for i=1:nparampool

View File

@ -2,7 +2,7 @@ verbatim;
options_.noprint = true; options_.noprint = true;
number_of_simulations = 1000; number_of_simulations = 1;
calibrated_values = M_.params; calibrated_values = M_.params;
Sigma_e = M_.Sigma_e; Sigma_e = M_.Sigma_e;
@ -28,6 +28,9 @@ verbatim;
idxs = find(cellfun(@isempty, names)); idxs = find(cellfun(@isempty, names));
% Perform the estimation of equation 7. % Perform the estimation of equation 7.
dyn_ols(simdata{idxs}, {}, {'eq7'}); dyn_ols(simdata{idxs}, {}, {'eq7'});
if i ~= number_of_simulations
oo_ = rmfield(oo_, 'ols');
end
% Store the estimation results in Beta % Store the estimation results in Beta
Beta(i, :) = M_.params'; Beta(i, :) = M_.params';
end end
@ -35,6 +38,35 @@ verbatim;
% Get the indices of the estimated parameters % Get the indices of the estimated parameters
pid = oo_.ols.eq7.param_idxs; pid = oo_.ols.eq7.param_idxs;
if number_of_simulations > 1
if max(abs(calibrated_values(pid)-mean(Beta(:,pid)', 2)))>1e-2
error('There is probably an error in the OLS routine.')
end
else
if strcmp(M_.fname, 'ols')
good = [-0.027702100375691
0.486913131141265
0.002639663639062
0.025487074270635
-0.126705792250240];
elseif strcmp(M_.fname, 'ols_wc_1')
good = [0.466534186307255
-0.010596174928406
0.035098464382347
-0.126502172176703];
elseif strcmp(M_.fname, 'ols_wc_2')
good = [0.485802603276717
0.002660854661647
-0.043688440124315
0.025434782170432
-0.126939890810119];
end
if max(abs(good-Beta(:,pid)'))>1e-2
error('There is probably an error in the OLS routine.')
end
return
end
for i=1:length(pid) for i=1:length(pid)
figure(i) figure(i)
hold on hold on
@ -49,9 +81,5 @@ verbatim;
hold off hold off
end 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; end;