From 2d6e51373813feba80c3aefc380b200893fd605c Mon Sep 17 00:00:00 2001 From: Marco Ratto Date: Tue, 10 Dec 2013 10:54:47 +0100 Subject: [PATCH 1/3] Bug fix with irf restriction on period larger than 1 --- matlab/endogenous_prior_restrictions.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/matlab/endogenous_prior_restrictions.m b/matlab/endogenous_prior_restrictions.m index 981adbd6d..e28a726ae 100644 --- a/matlab/endogenous_prior_restrictions.m +++ b/matlab/endogenous_prior_restrictions.m @@ -42,11 +42,11 @@ end infos=[0 0]; varlist=Model.endo_names(DynareResults.dr.order_var,:); varlist=varlist(DynareResults.dr.restrict_var_list,:); -T=1; +NT=1; for j=1:size(endo_prior_restrictions.irf,1), - T=max(T,endo_prior_restrictions.irf{j,3}); + NT=max(NT,endo_prior_restrictions.irf{j,3}); end -for t=1:T, +for t=1:NT, RR = T^(t-1)*R; for j=1:size(endo_prior_restrictions.irf,1), if endo_prior_restrictions.irf{j,3}~=t, From 67d7ba75f0c306d29609fca7f99a2205cd820def Mon Sep 17 00:00:00 2001 From: Marco Ratto Date: Tue, 10 Dec 2013 11:05:54 +0100 Subject: [PATCH 2/3] 1) Define a new type of parameter Random_prior_params, when prior/posterior mean mode do not work and the code searches randomly in the prior space a parameter combination that provides unique saddle path solution; 2) save point estimates in separate file, in order not lose work when subsequent analyses are done for prior/posterior mean/mode etc. --- matlab/dynare_identification.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/matlab/dynare_identification.m b/matlab/dynare_identification.m index 1547604cf..07c4d6656 100644 --- a/matlab/dynare_identification.m +++ b/matlab/dynare_identification.m @@ -334,6 +334,8 @@ if iload <=0, disp('----------- ') skipline() return + else + parameters = 'Random_prior_params'; end else idehess_point.params=params; @@ -344,6 +346,7 @@ if iload <=0, % normJ = max(abs(siJ)')'; % normLRE = max(abs(siLRE)')'; save([IdentifDirectoryName '/' M_.fname '_identif.mat'], 'idehess_point', 'idemoments_point','idemodel_point', 'idelre_point','store_options_ident') + save([IdentifDirectoryName '/' M_.fname '_' parameters '_identif.mat'], 'idehess_point', 'idemoments_point','idemodel_point', 'idelre_point','store_options_ident') disp_identification(params, idemodel_point, idemoments_point, name, advanced); if ~options_.nograph, plot_identification(params,idemoments_point,idehess_point,idemodel_point,idelre_point,advanced,parameters,name,IdentifDirectoryName); From b3c4f9427fd64274230ed4fbc6068e5ecb82e4db Mon Sep 17 00:00:00 2001 From: Marco Ratto Date: Tue, 10 Dec 2013 11:22:15 +0100 Subject: [PATCH 3/3] Fixed bad representation of identification patterns for moment information matrix (and also fixed figure title) --- matlab/plot_identification.m | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/matlab/plot_identification.m b/matlab/plot_identification.m index 278133ce7..38e7c976f 100644 --- a/matlab/plot_identification.m +++ b/matlab/plot_identification.m @@ -153,9 +153,9 @@ if SampleSize == 1, dyn_saveas(hh,[ IdentifDirectoryName '/' M_.fname '_ident_collinearity_' tittxt1 '_' int2str(j) ],options_); end skipline() + [U,S,V]=svd(idehess.AHess,0); + S=diag(S); if idehess.flag_score, - [U,S,V]=svd(idehess.AHess,0); - S=diag(S); if nparam<5, f1 = dyn_figure(options_,'Name',[tittxt,' - Identification patterns (Information matrix)']); else @@ -163,13 +163,13 @@ if SampleSize == 1, f2 = dyn_figure(options_,'Name',[tittxt,' - Identification patterns (Information matrix): HIGHEST SV']); end else - S = idemoments.S; - V = idemoments.V; +% S = idemoments.S; +% V = idemoments.V; if nparam<5, - f1 = dyn_figure(options_,'Name',[tittxt,' - Identification patterns (moments)']); + f1 = dyn_figure(options_,'Name',[tittxt,' - Identification patterns (moments Information matrix)']); else - f1 = dyn_figure(options_,'Name',[tittxt,' - Identification patterns (moments): SMALLEST SV']); - f2 = dyn_figure(options_,'Name',[tittxt,' - Identification patterns (moments): HIGHEST SV']); + f1 = dyn_figure(options_,'Name',[tittxt,' - Identification patterns (moments Information matrix): SMALLEST SV']); + f2 = dyn_figure(options_,'Name',[tittxt,' - Identification patterns (moments Information matrix): HIGHEST SV']); end end for j=1:min(nparam,8),