Commit 00cdc05d authored by Johannes Pfeifer's avatar Johannes Pfeifer
Browse files

Pass title texts to ident_bruteforce.m to make sure that previous TeX output...

Pass title texts to ident_bruteforce.m to make sure that previous TeX output is not overwritten by advanced option
parent e06bb9e0
......@@ -291,7 +291,7 @@ if iload <=0,
disp('Testing current parameter values')
end
[idehess_point, idemoments_point, idemodel_point, idelre_point, derivatives_info_point, info, options_ident] = ...
identification_analysis(params,indx,indexo,options_ident,dataset_, dataset_info, prior_exist, name_tex,1);
identification_analysis(params,indx,indexo,options_ident,dataset_, dataset_info, prior_exist, name_tex,1,parameters);
if info(1)~=0,
skipline()
disp('----------- ')
......@@ -334,7 +334,7 @@ if iload <=0,
kk=kk+1;
params = prior_draw();
[idehess_point, idemoments_point, idemodel_point, idelre_point, derivatives_info_point, info, options_ident] = ...
identification_analysis(params,indx,indexo,options_ident,dataset_,dataset_info, prior_exist, name_tex,1);
identification_analysis(params,indx,indexo,options_ident,dataset_,dataset_info, prior_exist, name_tex,1,'Random_prior_params');
end
end
if info(1)
......@@ -558,7 +558,7 @@ if SampleSize > 1,
disp(['Testing ',tittxt, '. Press ENTER']), pause(5),
if ~iload,
[idehess_max, idemoments_max, idemodel_max, idelre_max, derivatives_info_max, info_max, options_ident] = ...
identification_analysis(pdraws(jmax,:),indx,indexo,options_ident,dataset_,dataset_info, prior_exist, name_tex,1);
identification_analysis(pdraws(jmax,:),indx,indexo,options_ident,dataset_,dataset_info, prior_exist, name_tex,1,tittxt);
save([IdentifDirectoryName '/' M_.fname '_identif.mat'], 'idehess_max', 'idemoments_max','idemodel_max', 'idelre_max', 'jmax', '-append');
end
disp_identification(pdraws(jmax,:), idemodel_max, idemoments_max, name,1);
......@@ -573,7 +573,7 @@ if SampleSize > 1,
disp(['Testing ',tittxt, '. Press ENTER']), pause(5),
if ~iload,
[idehess_min, idemoments_min, idemodel_min, idelre_min, derivatives_info_min, info_min, options_ident] = ...
identification_analysis(pdraws(jmin,:),indx,indexo,options_ident,dataset_, dataset_info, prior_exist, name_tex,1);
identification_analysis(pdraws(jmin,:),indx,indexo,options_ident,dataset_, dataset_info, prior_exist, name_tex,1,tittxt);
save([IdentifDirectoryName '/' M_.fname '_identif.mat'], 'idehess_min', 'idemoments_min','idemodel_min', 'idelre_min', 'jmin', '-append');
end
disp_identification(pdraws(jmin,:), idemodel_min, idemoments_min, name,1);
......@@ -588,7 +588,7 @@ if SampleSize > 1,
disp(['Testing ',tittxt, '. Press ENTER']), pause(5),
if ~iload,
[idehess_(j), idemoments_(j), idemodel_(j), idelre_(j), derivatives_info_(j), info_resolve, options_ident] = ...
identification_analysis(pdraws(jcrit(j),:),indx,indexo,options_ident,dataset_, dataset_info, prior_exist, name_tex,1);
identification_analysis(pdraws(jcrit(j),:),indx,indexo,options_ident,dataset_, dataset_info, prior_exist, name_tex,1,tittxt);
end
disp_identification(pdraws(jcrit(j),:), idemodel_(j), idemoments_(j), name,1);
close all,
......
function [pars, cosnJ] = ident_bruteforce(J,n,TeX, pnames_TeX)
% function [pars, cosnJ] = ident_bruteforce(J,n,TeX, pnames_TeX)
function [pars, cosnJ] = ident_bruteforce(J,n,TeX, pnames_TeX,tittxt)
% function [pars, cosnJ] = ident_bruteforce(J,n,TeX, pnames_TeX,tittxt)
%
% given the Jacobian matrix J of moment derivatives w.r.t. parameters
% computes, for each column of J, the groups of columns from 1 to n that
% can repliate at best the derivatives of that column
%
% INPUTS
% J [double] (normalized) Jacobian matrix of moment derivatives
% n [scalar] maximum size of covariance groups tested
% TeX [scalar] Indicator whether TeX-output is requested
% pnames_TeX [char] list of tex names
% tittxt [string] string indicating the title text for
% graphs and figures
%
% OUTPUTS
% pars : cell array with groupf of params for each column of J for 1 to n
% cosnJ : the cosn of each column with the selected group of columns
......@@ -36,8 +44,12 @@ if nargin<2 || isempty(n)
end
if nargin<3 || isempty(TeX)
TeX = 0; % max n-tuple
tittxt='';
end
tittxt1=regexprep(tittxt, ' ', '_');
tittxt1=strrep(tittxt1, '.', '');
cosnJ=zeros(k,n);
pars{k,n}=[];
for ll = 1:n,
......@@ -66,18 +78,18 @@ for ll = 1:n,
end
dyn_waitbar_close(h);
if TeX
filename = [OutputDirectoryName '/' M_.fname '_collinearity_patterns' int2str(ll) '.tex'];
filename = [OutputDirectoryName '/' M_.fname '_collin_patterns_',tittxt1,'_' int2str(ll) '.tex'];
fidTeX = fopen(filename,'w');
fprintf(fidTeX,'%% TeX-table generated by ident_bruteforce (Dynare).\n');
fprintf(fidTeX,['%% Collinearity patterns with ',int2str(ll),' parameter(s)\n']);
fprintf(fidTeX,['%% Collinearity patterns with ',int2str(ll),' parameter(s): ',tittxt,'\n']);
fprintf(fidTeX,['%% ' datestr(now,0)]);
fprintf(fidTeX,' \n');
fprintf(fidTeX,' \n');
fprintf(fidTeX,'{\\tiny \n');
fprintf(fidTeX,'\\begin{longtable}{llc} \n');
fprintf(fidTeX,['\\caption{Collinearity patterns with ',int2str(ll),' parameter(s)}\n ']);
fprintf(fidTeX,['\\label{Table:CollinearityPatterns:',int2str(ll),'}\\\\\n']);
fprintf(fidTeX,['\\caption{Collinearity patterns with ',int2str(ll),' parameter(s): ',tittxt,'}\n ']);
fprintf(fidTeX,['\\label{Table:CollinearityPatterns:',tittxt1,':',int2str(ll),'}\\\\\n']);
fprintf(fidTeX,'\\toprule \n');
fprintf(fidTeX,' Parameter & Explanatory & cosn \\\\ \n');
fprintf(fidTeX,' & parameter(s) & \\\\ \n');
......
function [ide_hess, ide_moments, ide_model, ide_lre, derivatives_info, info, options_ident] = identification_analysis(params,indx,indexo,options_ident,dataset_,dataset_info, prior_exist, name_tex, init)
% function [ide_hess, ide_moments, ide_model, ide_lre, derivatives_info, info] = identification_analysis(params,indx,indexo,options_ident,data_info, prior_exist, name_tex, init)
function [ide_hess, ide_moments, ide_model, ide_lre, derivatives_info, info, options_ident] = identification_analysis(params,indx,indexo,options_ident,dataset_,dataset_info, prior_exist,name_tex,init,tittxt)
% function [ide_hess, ide_moments, ide_model, ide_lre, derivatives_info, info] = identification_analysis(params,indx,indexo,options_ident,data_info, prior_exist,name_tex,init,analyis_type)
% given the parameter vector params, wraps all identification analyses
%
% INPUTS
......@@ -14,6 +14,8 @@ function [ide_hess, ide_moments, ide_model, ide_lre, derivatives_info, info, opt
% =0 when prior is not defined and indentification is checked for all params and shocks
% o name_tex [char] list of tex names
% o init [integer] flag for initialization of persistent vars
% o tittxt [string] string indicating the title text for
% graphs and figures
%
% OUTPUTS
% o ide_hess [structure] identification results using Asymptotic Hessian
......@@ -348,6 +350,6 @@ if info(1)==0,
indok = find(max(ide_moments.indno,[],1)==0);
if advanced,
[ide_moments.pars, ide_moments.cosnJ] = ident_bruteforce(JJ(indJJ,:)./normJ,max_dim_cova_group,options_.TeX,name_tex);
[ide_moments.pars, ide_moments.cosnJ] = ident_bruteforce(JJ(indJJ,:)./normJ,max_dim_cova_group,options_.TeX,name_tex,tittxt);
end
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment