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
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/panel_var_diff_NB_simulation_test.mod \
ecb/SUR/panel_var_diff_NB_simulation_zero_eq.mod \
ecb/pooled_ols/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
ecb/pooled_fgls/panel_var_diff_NB_simulation_test.mod
MODFILES += $(OLS_MODFILES)

View File

@ -148,14 +148,13 @@ var res_DE_G_YER = 0.005;
var res_DE_EHIC = 0.005;
end;
NSIMS = 1000;
NSIMS = 1;
options_.noprint = 1;
calibrated_values = M_.params;
verbatim;
Sigma_e = M_.Sigma_e;
end;
assert(NSIMS > 1);
options_.bnlms.set_dynare_seed_to_default = false;
nparampool = length(M_.params);
@ -175,36 +174,43 @@ for i=1:NSIMS
end
sur(simdata{idxs});
BETA(i, :) = M_.params';
oo_ = rmfield(oo_, 'sur');
end
tmp = mean(BETA)' - calibrated_values;
good = [-0.000851206009290
-0.000643198850342
-0.000077654636303
-0.000420898437454
0.000262557551524
-0.000245111192739
-0.000076643809917
-0.001731735812364
-0.001143888514328
0.000121014793695
-0.000577022127737
-0.000749730989778
-0.000277999433209
-0.000622189775653
-0.000635550804554
-0.000249226746560
-0.000444130561721
-0.000186765256265
-0.000441923342534
-0.000014925384893
0.000091140073668
-0.000237339805772
-0.000838249050874
0.000815931859253
0];
if sum(abs(tmp-good)) > 1e-14
error(['sum of tmp - good was: ' num2str(sum(abs(tmp-good)))]);
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

View File

@ -144,7 +144,7 @@ var res_DE_G_YER = 0.005;
var res_DE_EHIC = 0.005;
end;
NSIMS = 1000;
NSIMS = 1;
options_.noprint = 1;
calibrated_values = M_.params;
@ -173,42 +173,43 @@ for i=1:NSIMS
end
sur(simdata{idxs});
BETA(i, :) = M_.params';
oo_ = rmfield(oo_, 'sur');
end
if size(BETA',2) == 1
tmp = BETA' - calibrated_values;
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
tmp = mean(BETA)' - calibrated_values;
end
good = [-0.003887531498207
-0.002565330545918
-0.000239567336676
0.003408443512070
0.001553818170767
-0.000469903487876
-0.001112844922537
-0.003118147971245
0.000781155700883
-0.000803694625262
-0.002236638387246
-0.000683200861198
-0.000310394894060
0
0
-0.000086918837962
-0.000383472263486
0.000820117983637
0.000953382489529
0.000989541137148
-0.001083720105374
-0.000359301045695
-0.001656187747193
0.000462206249631
0];
if sum(abs(tmp-good)) > 1e-14
error(['sum of tmp - good was: ' num2str(sum(abs(tmp-good)))]);
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

View File

@ -148,14 +148,13 @@ var res_DE_G_YER = 0.005;
var res_DE_EHIC = 0.005;
end;
NSIMS = 1000;
NSIMS = 1;
options_.noprint = 1;
calibrated_values = M_.params;
verbatim;
Sigma_e = M_.Sigma_e;
end;
assert(NSIMS > 1);
options_.bnlms.set_dynare_seed_to_default = false;
nparampool = length(M_.params);
@ -175,36 +174,43 @@ for i=1:NSIMS
end
sur(simdata{idxs}, {}, {}, 'mymodel', true);
BETA(i, :) = M_.params';
oo_ = rmfield(oo_, 'sur');
end
tmp = mean(BETA)' - calibrated_values;
good = [-0.000851256219733
-0.000643255670073
-0.000078774226193
-0.000420026410496
0.000262319820667
-0.000245434738588
-0.000076193984629
-0.001732502219600
-0.001142802053612
0.000120684867379
-0.000577323101449
-0.000750502207473
-0.000277709424315
-0.000622119904600
-0.000635564841533
-0.000249342272071
-0.000443999454424
-0.000187590389264
-0.000441672489341
-0.000015259855753
0.000091236076295
-0.000236028177813
-0.000838101091676
0.000815800740293
0];
if sum(abs(tmp-good)) > 1e-14
error(['sum of tmp - good was: ' num2str(sum(abs(tmp-good)))]);
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

View File

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

View File

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

View File

@ -2,7 +2,7 @@ verbatim;
options_.noprint = true;
number_of_simulations = 1000;
number_of_simulations = 1;
calibrated_values = M_.params;
Sigma_e = M_.Sigma_e;
@ -28,6 +28,9 @@ verbatim;
idxs = find(cellfun(@isempty, names));
% Perform the estimation of equation 7.
dyn_ols(simdata{idxs}, {}, {'eq7'});
if i ~= number_of_simulations
oo_ = rmfield(oo_, 'ols');
end
% Store the estimation results in Beta
Beta(i, :) = M_.params';
end
@ -35,6 +38,35 @@ verbatim;
% Get the indices of the estimated parameters
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)
figure(i)
hold on
@ -49,9 +81,5 @@ verbatim;
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;