Merge remote-tracking branch 'remotes/ratto/master'
commit
b55a96556d
|
@ -57,7 +57,7 @@ FirstMhFile = record.KeepedDraws.FirstMhFile;
|
|||
NumberOfDraws = TotalNumberOfMhDraws-floor(options_.mh_drop*TotalNumberOfMhDraws);
|
||||
clear record;
|
||||
|
||||
pnames=[' ';'beta ';'gamm ';'norm ';'invg ';'unif ';'invg2'];
|
||||
pnames=[' ';'beta ';'gamma';'norm ';'invg ';'unif ';'invg2'];
|
||||
header_width = row_header_width(M_,estim_params_,bayestopt_);
|
||||
tit2 = sprintf('%-*s %10s %10s %16s %6s %10s\n',header_width+2,' ','prior mean','post. mean','conf. interval','prior','pstdev');
|
||||
pformat = '%-*s %10.3f %10.4f %10.4f %8.4f %6s %10.4f';
|
||||
|
@ -103,6 +103,8 @@ if np
|
|||
pnames(bayestopt_.pshape(ip)+1,:), ...
|
||||
bayestopt_.p2(ip)));
|
||||
if TeX
|
||||
k = estim_params_.param_vals(i,1);
|
||||
name = deblank(M_.param_names_tex(k,:));
|
||||
TeXCore(fid,name,deblank(pnames(bayestopt_.pshape(ip)+1,:)),bayestopt_.p1(ip),...
|
||||
bayestopt_.p2(ip),post_mean,sqrt(post_var),hpd_interval);
|
||||
end
|
||||
|
@ -147,7 +149,8 @@ if nvx
|
|||
end
|
||||
disp(sprintf(pformat,header_width,name,bayestopt_.p1(ip),post_mean,hpd_interval,...
|
||||
pnames(bayestopt_.pshape(ip)+1,:),bayestopt_.p2(ip)));
|
||||
if TeX
|
||||
if TeX,
|
||||
name = deblank(M_.exo_names_tex(k,:));
|
||||
TeXCore(fid,name,deblank(pnames(bayestopt_.pshape(ip)+1,:)),bayestopt_.p1(ip),...
|
||||
bayestopt_.p2(ip),post_mean,sqrt(post_var),hpd_interval);
|
||||
end
|
||||
|
@ -188,6 +191,8 @@ if nvn
|
|||
disp(sprintf(pformat,header_width,name,bayestopt_.p1(ip),post_mean,hpd_interval, ...
|
||||
pnames(bayestopt_.pshape(ip)+1,:),bayestopt_.p2(ip)));
|
||||
if TeX
|
||||
k = estim_params_.var_endo(i,1);
|
||||
name = deblank(M_.endo_names_tex(k,:));
|
||||
TeXCore(fid,name,deblank(pnames(bayestopt_.pshape(ip)+1,:)),bayestopt_.p1(ip),...
|
||||
bayestopt_.p2(ip),post_mean,sqrt(post_var),hpd_interval);
|
||||
end
|
||||
|
@ -241,6 +246,7 @@ if ncx
|
|||
disp(sprintf(pformat, header_width,name,bayestopt_.p1(ip),post_mean,hpd_interval, ...
|
||||
pnames(bayestopt_.pshape(ip)+1,:),bayestopt_.p2(ip)));
|
||||
if TeX
|
||||
name = ['(',deblank(M_.exo_names_tex(k1,:)) ',' deblank(M_.exo_names_tex(k2,:)),')'];
|
||||
TeXCore(fid,name,deblank(pnames(bayestopt_.pshape(ip)+1,:)),bayestopt_.p1(ip),...
|
||||
bayestopt_.p2(ip),post_mean,sqrt(post_var),hpd_interval);
|
||||
end
|
||||
|
@ -291,7 +297,8 @@ if ncn
|
|||
end
|
||||
disp(sprintf(pformat, header_width,name,bayestopt_.p1(ip),post_mean,hpd_interval, ...
|
||||
pnames(bayestopt_.pshape(ip)+1,:),bayestopt_.p2(ip)));
|
||||
if TeX
|
||||
if TeX,
|
||||
name = ['(',deblank(M_.endo_names_tex(k1,:)) ',' deblank(M_.endo_names_tex(k2,:)),')'];
|
||||
TeXCore(fid,name,deblank(pnames(bayestopt_.pshape(ip)+1,:)),bayestopt_.p1(ip),...
|
||||
bayestopt_.p2(ip),post_mean,sqrt(post_var),hpd_interval);
|
||||
end
|
||||
|
@ -314,13 +321,25 @@ fprintf(fidTeX,['%% RESULTS FROM METROPOLIS HASTINGS (' title ')\n']);
|
|||
fprintf(fidTeX,['%% ' datestr(now,0)]);
|
||||
fprintf(fidTeX,' \n');
|
||||
fprintf(fidTeX,' \n');
|
||||
fprintf(fidTeX,'\\begin{table}\n');
|
||||
fprintf(fidTeX,'\\centering\n');
|
||||
fprintf(fidTeX,'\\begin{tabular}{l|lcccccc} \n');
|
||||
fprintf(fidTeX,'\\begin{center}\n');
|
||||
fprintf(fidTeX,'\\begin{longtable}{l|lcccccc} \n');
|
||||
fprintf(fidTeX,['\\caption{Results from Metropolis-Hastings (' title ')}\n ']);
|
||||
fprintf(fidTeX,['\\label{Table:MHPosterior:' int2str(fnum) '}\\\\\n']);
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,[' & Prior distribution & Prior mean & Prior ' ...
|
||||
's.d. & Posterior mean & Posterior s.d. & HPD inf & HPD sup\\\\ \n']);
|
||||
fprintf(fidTeX,'\\hline \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\endfirsthead \n');
|
||||
fprintf(fidTeX,['\\caption{(continued)}']);
|
||||
fprintf(fidTeX,['\\label{Table:MHPosterior:' int2str(fnum) '}\\\\\n']);
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,[' & Prior distribution & Prior mean & Prior ' ...
|
||||
's.d. & Posterior mean & Posterior s.d. & HPD inf & HPD sup\\\\ \n']);
|
||||
fprintf(fidTeX,'\\hline \\endhead \n');
|
||||
|
||||
fprintf(fidTeX,'\\hline \\multicolumn{8}{r}{(Continued on next page)} \\\\ \\hline \\endfoot \n');
|
||||
fprintf(fidTeX,'\\hline \\hline \\endlastfoot \n');
|
||||
|
||||
|
||||
fid = fidTeX;
|
||||
|
||||
|
||||
|
@ -337,11 +356,8 @@ fprintf(fid,['$%s$ & %s & %7.3f & %6.4f & %7.3f& %6.4f & %7.4f & %7.4f \\\\ \n']
|
|||
|
||||
|
||||
function TeXEnd(fid,fnum,title)
|
||||
fprintf(fid,'\\hline\\hline \n');
|
||||
fprintf(fid,'\\end{tabular}\n ');
|
||||
fprintf(fid,['\\caption{Results from Metropolis-Hastings (' title ')}\n ']);
|
||||
fprintf(fid,['\\label{Table:MHPosterior:' int2str(fnum) '}\n']);
|
||||
fprintf(fid,'\\end{table}\n');
|
||||
fprintf(fid,'\\end{longtable}\n ');
|
||||
fprintf(fid,'\\end{center}\n');
|
||||
fprintf(fid,'%% End of TeX file.\n');
|
||||
fclose(fid);
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ for i = 1:pages
|
|||
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TEXNAMES(jj,:)));
|
||||
end
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,'\\includegraphics[scale=0.5]{%s_udiag%s}\n',M_.fname,int2str(i));
|
||||
fprintf(fidTeX,'\\includegraphics[scale=0.5]{%s_udiag%s}\n',[DirectoryName '/' M_.fname],int2str(i));
|
||||
fprintf(fidTeX,'\\caption{Univariate convergence diagnostics for the Metropolis-Hastings.\n');
|
||||
fprintf(fidTeX,'The first, second and third columns are respectively the criteria based on\n');
|
||||
fprintf(fidTeX,'the eighty percent interval, the second and third moments.}');
|
||||
|
@ -238,7 +238,7 @@ if reste
|
|||
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TEXNAMES(jj,:)));
|
||||
end
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,'\\includegraphics[scale=0.5]{%s_udiag%s}\n',M_.fname,int2str(pages+1));
|
||||
fprintf(fidTeX,'\\includegraphics[scale=0.5]{%s_udiag%s}\n',[DirectoryName '/' M_.fname],int2str(pages+1));
|
||||
if reste == 2
|
||||
fprintf(fidTeX,'\\caption{Univariate convergence diagnostics for the Metropolis-Hastings.\n');
|
||||
fprintf(fidTeX,'The first, second and third columns are respectively the criteria based on\n');
|
||||
|
@ -348,7 +348,7 @@ if TeX
|
|||
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),' ');
|
||||
end
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,'\\includegraphics[scale=0.5]{%s_mdiag}\n',M_.fname);
|
||||
fprintf(fidTeX,'\\includegraphics[scale=0.5]{%s_mdiag}\n',[DirectoryName '/' M_.fname]);
|
||||
fprintf(fidTeX,'\\caption{Multivariate convergence diagnostics for the Metropolis-Hastings.\n');
|
||||
fprintf(fidTeX,'The first, second and third rows are respectively the criteria based on\n');
|
||||
fprintf(fidTeX,'the eighty percent interval, the second and third moments. The different \n');
|
||||
|
|
|
@ -159,7 +159,7 @@ for i=1:npar
|
|||
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(j,:)),deblank(TeXNAMES(j,:)));
|
||||
end
|
||||
fprintf(fidTeX,'\\centering\n');
|
||||
fprintf(fidTeX,'\\includegraphics[scale=0.5]{%s_PriorsAndPosteriors%s}\n',M_.fname,int2str(figunumber));
|
||||
fprintf(fidTeX,'\\includegraphics[scale=0.5]{%s/%s_PriorsAndPosteriors%s}\n',OutputDirectoryName,M_.fname,int2str(figunumber));
|
||||
fprintf(fidTeX,'\\caption{Priors and posteriors.}');
|
||||
fprintf(fidTeX,'\\label{Fig:PriorsAndPosteriors:%s}\n',int2str(figunumber));
|
||||
fprintf(fidTeX,'\\end{figure}\n');
|
||||
|
|
|
@ -172,6 +172,7 @@ localVars.IRUN = IRUN;
|
|||
localVars.irun = irun;
|
||||
localVars.irun2=irun2;
|
||||
localVars.nosaddle=nosaddle;
|
||||
localVars.npar = npar;
|
||||
|
||||
localVars.type=type;
|
||||
if strcmpi(type,'posterior')
|
||||
|
|
|
@ -53,20 +53,12 @@ IRUN = myinputs.IRUN;
|
|||
irun =myinputs.irun;
|
||||
irun2=myinputs.irun2;
|
||||
nosaddle=myinputs.nosaddle;
|
||||
npar=myinputs.npar;
|
||||
type=myinputs.type;
|
||||
if ~strcmpi(type,'prior'),
|
||||
x=myinputs.x;
|
||||
end
|
||||
|
||||
if options_.dsge_var
|
||||
gend=myinputs.gend;
|
||||
nvobs=myinputs.nvobs;
|
||||
NumberOfParametersPerEquation = myinputs.NumberOfParametersPerEquation;
|
||||
NumberOfLags = myinputs.NumberOfLags;
|
||||
NumberOfLagsTimesNvobs = myinputs.NumberOfLagsTimesNvobs;
|
||||
Companion_matrix = myinputs.Companion_matrix;
|
||||
end
|
||||
|
||||
nvar=myinputs.nvar;
|
||||
IndxVariables=myinputs.IndxVariables;
|
||||
MAX_nirfs_dsgevar=myinputs.MAX_nirfs_dsgevar;
|
||||
|
@ -77,6 +69,17 @@ NumberOfIRFfiles_dsge=myinputs.NumberOfIRFfiles_dsge;
|
|||
NumberOfIRFfiles_dsgevar=myinputs.NumberOfIRFfiles_dsgevar;
|
||||
ifil2=myinputs.ifil2;
|
||||
|
||||
if options_.dsge_var
|
||||
gend=myinputs.gend;
|
||||
nvobs=myinputs.nvobs;
|
||||
NumberOfParametersPerEquation = myinputs.NumberOfParametersPerEquation;
|
||||
NumberOfLags = myinputs.NumberOfLags;
|
||||
NumberOfLagsTimesNvobs = myinputs.NumberOfLagsTimesNvobs;
|
||||
Companion_matrix = myinputs.Companion_matrix;
|
||||
stock_irf_bvardsge = zeros(options_.irf,nvobs,M_.exo_nbr,MAX_nirfs_dsgevar);
|
||||
end
|
||||
|
||||
|
||||
if whoiam
|
||||
Parallel=myinputs.Parallel;
|
||||
end
|
||||
|
@ -129,7 +132,8 @@ if whoiam
|
|||
end
|
||||
|
||||
% Parallel 'while' very good!!!
|
||||
|
||||
stock_param=zeros(MAX_nruns,npar);
|
||||
stock_irf_dsge=zeros(options_.irf,nvar,M_.exo_nbr,MAX_nirfs_dsge);
|
||||
while fpar<npar
|
||||
fpar = fpar + 1;
|
||||
irun = irun+1;
|
||||
|
|
|
@ -630,15 +630,20 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
fprintf(fidTeX,['%% ' datestr(now,0)]);
|
||||
fprintf(fidTeX,' \n');
|
||||
fprintf(fidTeX,' \n');
|
||||
fprintf(fidTeX,'{\\tiny \n');
|
||||
fprintf(fidTeX,'\\begin{table}\n');
|
||||
fprintf(fidTeX,'\\centering\n');
|
||||
fprintf(fidTeX,'\\begin{center}\n');
|
||||
fprintf(fidTeX,'\\begin{longtable}{l|lcccc} \n');
|
||||
fprintf(fidTeX,'\\caption{Results from posterior maximization (parameters)}\n ');
|
||||
fprintf(fidTeX,'\\label{Table:Posterior:1}\n');
|
||||
fprintf(fidTeX,'\\begin{tabular}{l|lcccc} \n');
|
||||
fprintf(fidTeX,'\\label{Table:Posterior:1}\\\\\n');
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\endfirsthead \n');
|
||||
fprintf(fidTeX,'\\caption{(continued)}\n ');
|
||||
fprintf(fidTeX,'\\label{Table:Posterior:1}\\\\\n');
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\endhead \n');
|
||||
fprintf(fidTeX,'\\hline \\multicolumn{6}{r}{(Continued on next page)} \\\\ \\hline \\endfoot \n');
|
||||
fprintf(fidTeX,'\\hline \\hline \\endlastfoot \n');
|
||||
ip = nvx+nvn+ncx+ncn+1;
|
||||
for i=1:np
|
||||
fprintf(fidTeX,'$%s$ & %s & %7.3f & %6.4f & %8.4f & %7.4f \\\\ \n',...
|
||||
|
@ -649,24 +654,9 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
xparam1(ip),...
|
||||
stdh(ip));
|
||||
ip = ip + 1;
|
||||
if ~mod(i,50) && i<np,
|
||||
fprintf(fidTeX,'\\hline \n');
|
||||
fprintf(fidTeX,'\\multicolumn{6}{c}{(Table continues next page ...)} \\\\ \n')';
|
||||
fprintf(fidTeX,'\\end{tabular}\n ');
|
||||
fprintf(fidTeX,'\\end{table}\n');
|
||||
fprintf(fidTeX,'\\begin{table}\n');
|
||||
fprintf(fidTeX,'\\centering\n');
|
||||
fprintf(fidTeX,'\\begin{tabular}{l|lcccc} \n');
|
||||
fprintf(fidTeX,'\\multicolumn{6}{c}{( ... Table continued)} \\\\ \n')';
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\\\ \n');
|
||||
end
|
||||
end
|
||||
fprintf(fidTeX,'\\hline\\hline \n');
|
||||
fprintf(fidTeX,'\\end{tabular}\n ');
|
||||
fprintf(fidTeX,'\\end{table}\n');
|
||||
fprintf(fidTeX,'} \n');
|
||||
fprintf(fidTeX,'\\end{longtable}\n ');
|
||||
fprintf(fidTeX,'\\end{center}\n');
|
||||
fprintf(fidTeX,'%% End of TeX file.\n');
|
||||
fclose(fidTeX);
|
||||
end
|
||||
|
@ -678,15 +668,20 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
fprintf(fidTeX,['%% ' datestr(now,0)]);
|
||||
fprintf(fidTeX,' \n');
|
||||
fprintf(fidTeX,' \n');
|
||||
fprintf(fidTeX,'{\\tiny \n');
|
||||
fprintf(fidTeX,'\\begin{table}\n');
|
||||
fprintf(fidTeX,'\\centering\n');
|
||||
fprintf(fidTeX,'\\begin{center}\n');
|
||||
fprintf(fidTeX,'\\begin{longtable}{l|lcccc} \n');
|
||||
fprintf(fidTeX,'\\caption{Results from posterior maximization (standard deviation of structural shocks)}\n ');
|
||||
fprintf(fidTeX,'\\label{Table:Posterior:2}\n');
|
||||
fprintf(fidTeX,'\\begin{tabular}{l|lcccc} \n');
|
||||
fprintf(fidTeX,'\\label{Table:Posterior:2}\\\\\n');
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\endfirsthead \n');
|
||||
fprintf(fidTeX,'\\caption{(continued)}\n ');
|
||||
fprintf(fidTeX,'\\label{Table:Posterior:2}\\\\\n');
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\endhead \n');
|
||||
fprintf(fidTeX,'\\hline \\multicolumn{6}{r}{(Continued on next page)} \\\\ \\hline \\endfoot \n');
|
||||
fprintf(fidTeX,'\\hline \\hline \\endlastfoot \n');
|
||||
ip = 1;
|
||||
for i=1:nvx
|
||||
k = estim_params_.var_exo(i,1);
|
||||
|
@ -698,24 +693,9 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
xparam1(ip), ...
|
||||
stdh(ip));
|
||||
ip = ip+1;
|
||||
if ~mod(i,50) && i<nvx,
|
||||
fprintf(fidTeX,'\\hline \n');
|
||||
fprintf(fidTeX,'\\multicolumn{6}{c}{(Table continues next page ...)} \\\\ \n')';
|
||||
fprintf(fidTeX,'\\end{tabular}\n ');
|
||||
fprintf(fidTeX,'\\end{table}\n');
|
||||
fprintf(fidTeX,'\\begin{table}\n');
|
||||
fprintf(fidTeX,'\\centering\n');
|
||||
fprintf(fidTeX,'\\begin{tabular}{l|lcccc} \n');
|
||||
fprintf(fidTeX,'\\multicolumn{6}{c}{( ... Table continued)} \\\\ \n')';
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\\\ \n');
|
||||
end
|
||||
end
|
||||
fprintf(fidTeX,'\\hline\\hline \n');
|
||||
fprintf(fidTeX,'\\end{tabular}\n ');
|
||||
fprintf(fidTeX,'\\end{table}\n');
|
||||
fprintf(fidTeX,'} \n');
|
||||
fprintf(fidTeX,'\\end{longtable}\n ');
|
||||
fprintf(fidTeX,'\\end{center}\n');
|
||||
fprintf(fidTeX,'%% End of TeX file.\n');
|
||||
fclose(fidTeX);
|
||||
end
|
||||
|
@ -727,14 +707,20 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
fprintf(fidTeX,['%% ' datestr(now,0)]);
|
||||
fprintf(fidTeX,' \n');
|
||||
fprintf(fidTeX,' \n');
|
||||
fprintf(fidTeX,'\\begin{table}\n');
|
||||
fprintf(fidTeX,'\\centering\n');
|
||||
fprintf(fidTeX,'\\begin{center}\n');
|
||||
fprintf(fidTeX,'\\begin{longtable}{l|lcccc} \n');
|
||||
fprintf(fidTeX,'\\caption{Results from posterior maximization (standard deviation of measurement errors)}\n ');
|
||||
fprintf(fidTeX,'\\label{Table:Posterior:3}\n');
|
||||
fprintf(fidTeX,'\\begin{tabular}{l|lcccc} \n');
|
||||
fprintf(fidTeX,'\\label{Table:Posterior:3}\\\\\n');
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n')
|
||||
fprintf(fidTeX,'\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\endfirsthead \n');
|
||||
fprintf(fidTeX,'\\caption{(continued)}\n ');
|
||||
fprintf(fidTeX,'\\label{Table:Posterior:3}\\\\\n');
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\endhead \n');
|
||||
fprintf(fidTeX,'\\hline \\multicolumn{6}{r}{(Continued on next page)} \\\\ \\hline \\endfoot \n');
|
||||
fprintf(fidTeX,'\\hline \\hline \\endlastfoot \n');
|
||||
ip = nvx+1;
|
||||
for i=1:nvn
|
||||
idx = strmatch(options_.varobs(estim_params_.var_endo(i,1),:),M_.endo_names);
|
||||
|
@ -746,23 +732,9 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
xparam1(ip),...
|
||||
stdh(ip));
|
||||
ip = ip+1;
|
||||
if ~mod(i,50) && i<nvn,
|
||||
fprintf(fidTeX,'\\hline \n');
|
||||
fprintf(fidTeX,'\\multicolumn{6}{c}{(Table continues next page ...)} \\\\ \n')';
|
||||
fprintf(fidTeX,'\\end{tabular}\n ');
|
||||
fprintf(fidTeX,'\\end{table}\n');
|
||||
fprintf(fidTeX,'\\begin{table}\n');
|
||||
fprintf(fidTeX,'\\centering\n');
|
||||
fprintf(fidTeX,'\\begin{tabular}{l|lcccc} \n');
|
||||
fprintf(fidTeX,'\\multicolumn{6}{c}{( ... Table continued)} \\\\ \n')';
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\\\ \n');
|
||||
end
|
||||
end
|
||||
fprintf(fidTeX,'\\hline\\hline \n');
|
||||
fprintf(fidTeX,'\\end{tabular}\n ');
|
||||
fprintf(fidTeX,'\\end{table}\n');
|
||||
fprintf(fidTeX,'\\end{longtable}\n ');
|
||||
fprintf(fidTeX,'\\end{center}\n');
|
||||
fprintf(fidTeX,'%% End of TeX file.\n');
|
||||
fclose(fidTeX);
|
||||
end
|
||||
|
@ -774,14 +746,20 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
fprintf(fidTeX,['%% ' datestr(now,0)]);
|
||||
fprintf(fidTeX,' \n');
|
||||
fprintf(fidTeX,' \n');
|
||||
fprintf(fidTeX,'\\begin{table}\n');
|
||||
fprintf(fidTeX,'\\centering\n');
|
||||
fprintf(fidTeX,'\\begin{center}\n');
|
||||
fprintf(fidTeX,'\\begin{longtable}{l|lcccc} \n');
|
||||
fprintf(fidTeX,'\\caption{Results from posterior parameters (correlation of structural shocks)}\n ');
|
||||
fprintf(fidTeX,'\\label{Table:Posterior:4}\n');
|
||||
fprintf(fidTeX,'\\begin{tabular}{l|lcccc} \n');
|
||||
fprintf(fidTeX,'\\label{Table:Posterior:4}\\\\\n');
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n')
|
||||
fprintf(fidTeX,'\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\endfirsthead \n');
|
||||
fprintf(fidTeX,'\\caption{(continued)}\n ');
|
||||
fprintf(fidTeX,'\\label{Table:Posterior:4}\\\\\n');
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\endhead \n');
|
||||
fprintf(fidTeX,'\\hline \\multicolumn{6}{r}{(Continued on next page)} \\\\ \\hline \\endfoot \n');
|
||||
fprintf(fidTeX,'\\hline \\hline \\endlastfoot \n');
|
||||
ip = nvx+nvn+1;
|
||||
for i=1:ncx
|
||||
k1 = estim_params_.corrx(i,1);
|
||||
|
@ -794,23 +772,9 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
xparam1(ip), ...
|
||||
stdh(ip));
|
||||
ip = ip+1;
|
||||
if ~mod(i,50) && i<ncx,
|
||||
fprintf(fidTeX,'\\hline \n');
|
||||
fprintf(fidTeX,'\\multicolumn{6}{c}{(Table continues next page ...)} \\\\ \n')';
|
||||
fprintf(fidTeX,'\\end{tabular}\n ');
|
||||
fprintf(fidTeX,'\\end{table}\n');
|
||||
fprintf(fidTeX,'\\begin{table}\n');
|
||||
fprintf(fidTeX,'\\centering\n');
|
||||
fprintf(fidTeX,'\\begin{tabular}{l|lcccc} \n');
|
||||
fprintf(fidTeX,'\\multicolumn{6}{c}{( ... Table continued)} \\\\ \n')';
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\\\ \n');
|
||||
end
|
||||
end
|
||||
fprintf(fidTeX,'\\hline\\hline \n');
|
||||
fprintf(fidTeX,'\\end{tabular}\n ');
|
||||
fprintf(fidTeX,'\\end{table}\n');
|
||||
fprintf(fidTeX,'\\end{longtable}\n ');
|
||||
fprintf(fidTeX,'\\end{center}\n');
|
||||
fprintf(fidTeX,'%% End of TeX file.\n');
|
||||
fclose(fidTeX);
|
||||
end
|
||||
|
@ -822,14 +786,20 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
fprintf(fidTeX,['%% ' datestr(now,0)]);
|
||||
fprintf(fidTeX,' \n');
|
||||
fprintf(fidTeX,' \n');
|
||||
fprintf(fidTeX,'\\begin{table}\n');
|
||||
fprintf(fidTeX,'\\centering\n');
|
||||
fprintf(fidTeX,'\\begin{center}\n');
|
||||
fprintf(fidTeX,'\\begin{longtabe}{l|lcccc} \n');
|
||||
fprintf(fidTeX,'\\caption{Results from posterior parameters (correlation of measurement errors)}\n ');
|
||||
fprintf(fidTeX,'\\label{Table:Posterior:5}\n');
|
||||
fprintf(fidTeX,'\\begin{tabular}{l|lcccc} \n');
|
||||
fprintf(fidTeX,'\\label{Table:Posterior:5}\\\\\n');
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n')
|
||||
fprintf(fidTeX,'\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\endfirsthead \n');
|
||||
fprintf(fidTeX,'\\caption{(continued)}\n ');
|
||||
fprintf(fidTeX,'\\label{Table:Posterior:5}\\\\\n');
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\endhead \n');
|
||||
fprintf(fidTeX,'\\hline \\multicolumn{6}{r}{(Continued on next page)} \\\\ \\hline \\endfoot \n');
|
||||
fprintf(fidTeX,'\\hline \\hline \\endlastfoot \n');
|
||||
ip = nvx+nvn+ncx+1;
|
||||
for i=1:ncn
|
||||
k1 = estim_params_.corrn(i,1);
|
||||
|
@ -842,23 +812,9 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
xparam1(ip), ...
|
||||
stdh(ip));
|
||||
ip = ip+1;
|
||||
if ~mod(i,50) && i<ncn,
|
||||
fprintf(fidTeX,'\\hline \n');
|
||||
fprintf(fidTeX,'\\multicolumn{6}{c}{(Table continues next page ...)} \\\\ \n')';
|
||||
fprintf(fidTeX,'\\end{tabular}\n ');
|
||||
fprintf(fidTeX,'\\end{table}\n');
|
||||
fprintf(fidTeX,'\\begin{table}\n');
|
||||
fprintf(fidTeX,'\\centering\n');
|
||||
fprintf(fidTeX,'\\begin{tabular}{l|lcccc} \n');
|
||||
fprintf(fidTeX,'\\multicolumn{6}{c}{( ... Table continued)} \\\\ \n')';
|
||||
fprintf(fidTeX,'\\hline\\hline \\\\ \n');
|
||||
fprintf(fidTeX,' & Prior distribution & Prior mean & Prior s.d. & Posterior mode & s.d. \\\\ \n');
|
||||
fprintf(fidTeX,'\\hline \\\\ \n');
|
||||
end
|
||||
end
|
||||
fprintf(fidTeX,'\\hline\\hline \n');
|
||||
fprintf(fidTeX,'\\end{tabular}\n ');
|
||||
fprintf(fidTeX,'\\end{table}\n');
|
||||
fprintf(fidTeX,'\\end{longtable}\n ');
|
||||
fprintf(fidTeX,'\\end{center}\n');
|
||||
fprintf(fidTeX,'%% End of TeX file.\n');
|
||||
fclose(fidTeX);
|
||||
end
|
||||
|
|
|
@ -124,7 +124,7 @@ for plt = 1:nbplt,
|
|||
end
|
||||
for i=1:length(z)
|
||||
xx(kk) = z(i);
|
||||
[fval, exit_flag] = feval(fun,xx,DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults);
|
||||
[fval, junk1, junk2, exit_flag] = feval(fun,xx,DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults);
|
||||
if exit_flag
|
||||
y(i,1) = fval;
|
||||
else
|
||||
|
|
94
matlab/pm3.m
94
matlab/pm3.m
|
@ -41,12 +41,16 @@ else
|
|||
end
|
||||
if options_.TeX
|
||||
% needs to be fixed
|
||||
if isempty(tit_tex),
|
||||
tit_tex=M_.endo_names_tex;
|
||||
end
|
||||
|
||||
varlist_TeX = [];
|
||||
for i=1:nvar
|
||||
if i==1
|
||||
varlist_TeX = M_.endo_names_tex(SelecVariables(i),:);
|
||||
varlist_TeX = tit_tex(SelecVariables(i),:);
|
||||
else
|
||||
varlist_TeX = char(varlist_TeX,M_.endo_names_tex(SelecVariables(i),:));
|
||||
varlist_TeX = char(varlist_TeX,tit_tex(SelecVariables(i),:));
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -97,40 +101,6 @@ end
|
|||
% %%% The file .TeX! are not saved in parallel.
|
||||
|
||||
|
||||
subplotnum = 0;
|
||||
|
||||
if options_.TeX
|
||||
fidTeX = fopen([M_.dname '/Output/' M_.fname '_' name3 '.TeX'],'w');
|
||||
fprintf(fidTeX,'%% TeX eps-loader file generated by Dynare.\n');
|
||||
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
|
||||
fprintf(fidTeX,' \n');
|
||||
|
||||
for i=1:nvar
|
||||
NAMES = [];
|
||||
TEXNAMES = [];
|
||||
if max(abs(Mean(:,i))) > 10^(-6)
|
||||
subplotnum = subplotnum+1;
|
||||
name = deblank(varlist(i,:));
|
||||
NAMES = name;
|
||||
texname = deblank(varlist_TeX(i,:));
|
||||
TEXNAMES = ['$' texname '$'];
|
||||
end
|
||||
if subplotnum == MaxNumberOfPlotsPerFigure || i == nvar
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
for jj = 1:size(TEXNAMES,1)
|
||||
fprintf(fidTeX,['\\psfrag{%s}[1][][0.5][0]{%s}\n'],deblank(NAMES(jj,:)),deblank(TEXNAMES(jj,:)));
|
||||
end
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,['\\includegraphics[scale=0.5]{%s_' name3 '_%s}\n'],M_.fname,deblank(tit3(i,:)));
|
||||
fprintf(fidTeX,'\\label{Fig:%s:%s}\n',name3,deblank(tit3(i,:)));
|
||||
fprintf(fidTeX,'\\end{figure}\n');
|
||||
fprintf(fidTeX,' \n');
|
||||
subplotnum = 0;
|
||||
end
|
||||
end
|
||||
fprintf(fidTeX,'%% End of TeX file.\n');
|
||||
fclose(fidTeX);
|
||||
end
|
||||
|
||||
% Store the variable mandatory for local/remote parallel computing.
|
||||
|
||||
|
@ -146,7 +116,7 @@ localVars.name3=name3;
|
|||
localVars.tit3=tit3;
|
||||
localVars.Mean=Mean;
|
||||
% Like sequential execution!
|
||||
|
||||
nvar0=nvar;
|
||||
|
||||
if ~exist('OCTAVE_VERSION')
|
||||
% Commenting for testing!
|
||||
|
@ -165,7 +135,7 @@ if ~exist('OCTAVE_VERSION')
|
|||
globalVars = struct('M_',M_, ...
|
||||
'options_', options_, ...
|
||||
'oo_', oo_);
|
||||
[fout, nBlockPerCPU, totCPU] = masterParallel(options_.parallel, 1, nvar, [],'pm3_core', localVars,globalVars, options_.parallel_info);
|
||||
[fout, nvar0, totCPU] = masterParallel(options_.parallel, 1, nvar, [],'pm3_core', localVars,globalVars, options_.parallel_info);
|
||||
end
|
||||
end
|
||||
else
|
||||
|
@ -175,6 +145,54 @@ else
|
|||
fout = pm3_core(localVars,1,nvar,0);
|
||||
end
|
||||
|
||||
subplotnum = 0;
|
||||
|
||||
if options_.TeX,
|
||||
fidTeX = fopen([M_.dname '/Output/' M_.fname '_' name3 '.TeX'],'w');
|
||||
fprintf(fidTeX,'%% TeX eps-loader file generated by Dynare.\n');
|
||||
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
|
||||
fprintf(fidTeX,' \n');
|
||||
nvar0=cumsum(nvar0);
|
||||
|
||||
i=0;
|
||||
for j=1:length(nvar0),
|
||||
|
||||
NAMES = [];
|
||||
TEXNAMES = [];
|
||||
nvar=nvar0(j);
|
||||
while i<nvar,
|
||||
i=i+1;
|
||||
if max(abs(Mean(:,i))) > 10^(-6)
|
||||
subplotnum = subplotnum+1;
|
||||
name = deblank(varlist(i,:));
|
||||
texname = deblank(varlist_TeX(i,:));
|
||||
if subplotnum==1
|
||||
NAMES = name;
|
||||
TEXNAMES = ['$' texname '$'];
|
||||
else
|
||||
NAMES = char(NAMES,name);
|
||||
TEXNAMES = char(TEXNAMES,['$' texname '$']);
|
||||
end
|
||||
end
|
||||
if subplotnum == MaxNumberOfPlotsPerFigure || i == nvar
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
for jj = 1:size(TEXNAMES,1)
|
||||
fprintf(fidTeX,['\\psfrag{%s}[1][][0.5][0]{%s}\n'],deblank(NAMES(jj,:)),deblank(TEXNAMES(jj,:)));
|
||||
end
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,['\\includegraphics[scale=0.5]{%s/Output/%s_' name3 '_%s}\n'],M_.dname,M_.fname,deblank(tit3(i,:)));
|
||||
fprintf(fidTeX,'\\label{Fig:%s:%s}\n',name3,deblank(tit3(i,:)));
|
||||
fprintf(fidTeX,'\\end{figure}\n');
|
||||
fprintf(fidTeX,' \n');
|
||||
subplotnum = 0;
|
||||
NAMES = [];
|
||||
TEXNAMES = [];
|
||||
end
|
||||
end
|
||||
end
|
||||
fprintf(fidTeX,'%% End of TeX file.\n');
|
||||
fclose(fidTeX);
|
||||
end
|
||||
|
||||
fprintf(['MH: ' tit1 ', done!\n']);
|
||||
|
||||
|
|
|
@ -221,13 +221,16 @@ if isnumeric(options_.parallel),
|
|||
% Parallel execution!
|
||||
else
|
||||
[nCPU, totCPU, nBlockPerCPU] = distributeJobs(options_.parallel, 1, B);
|
||||
ifil=zeros(7,totCPU);
|
||||
for j=1:totCPU-1,
|
||||
if run_smoother
|
||||
nfiles = ceil(nBlockPerCPU(j)/MAX_nsmoo);
|
||||
ifil(1,j+1) =ifil(1,j)+nfiles;
|
||||
nfiles = ceil(nBlockPerCPU(j)/MAX_ninno);
|
||||
ifil(2,j+1) =ifil(2,j)+nfiles;
|
||||
nfiles = ceil(nBlockPerCPU(j)/MAX_nerro);
|
||||
ifil(3,j+1) =ifil(3,j)+nfiles;
|
||||
end
|
||||
if naK
|
||||
nfiles = ceil(nBlockPerCPU(j)/MAX_naK);
|
||||
ifil(4,j+1) =ifil(4,j)+nfiles;
|
||||
|
@ -274,16 +277,16 @@ if ~isnumeric(options_.parallel),
|
|||
leaveSlaveOpen = options_.parallel_info.leaveSlaveOpen;
|
||||
if options_.parallel_info.leaveSlaveOpen == 0,
|
||||
% Commenting for testing!!!
|
||||
% options_.parallel_info.leaveSlaveOpen = 1; % Force locally to leave open remote matlab sessions (repeated pm3 calls)
|
||||
options_.parallel_info.leaveSlaveOpen = 1; % Force locally to leave open remote matlab sessions (repeated pm3 calls)
|
||||
end
|
||||
end
|
||||
|
||||
if options_.smoother
|
||||
pm3(endo_nbr,gend,ifil(1),B,'Smoothed variables',...
|
||||
'',M_.endo_names(1:M_.orig_endo_nbr, :),'tit_tex',M_.endo_names,...
|
||||
'',M_.endo_names(1:M_.orig_endo_nbr, :),M_.endo_names_tex,M_.endo_names,...
|
||||
varlist,'SmoothedVariables',DirectoryName,'_smooth');
|
||||
pm3(exo_nbr,gend,ifil(2),B,'Smoothed shocks',...
|
||||
'',M_.exo_names,'tit_tex',M_.exo_names,...
|
||||
'',M_.exo_names,M_.exo_names_tex,M_.exo_names,...
|
||||
M_.exo_names,'SmoothedShocks',DirectoryName,'_inno');
|
||||
if nvn
|
||||
% needs to be fixed
|
||||
|
|
Loading…
Reference in New Issue