From 0f8add00e624a1609f79102dd79a6da1f7732c9a Mon Sep 17 00:00:00 2001 From: adjemian Date: Fri, 3 Mar 2006 14:06:44 +0000 Subject: [PATCH] Correction of bugs related to TeX formatting. git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@642 ac1d8469-bf42-47a9-8791-bf33cf982152 --- matlab/dynare_estimation.m | 701 +++++++++++++++++++------------------ 1 file changed, 354 insertions(+), 347 deletions(-) diff --git a/matlab/dynare_estimation.m b/matlab/dynare_estimation.m index 9f25e3580..7683f1fe5 100644 --- a/matlab/dynare_estimation.m +++ b/matlab/dynare_estimation.m @@ -562,8 +562,9 @@ if any(bayestopt_.pshape > 0) & options_.TeX %% Bayesian estimation (posterior m fprintf(fidTeX,'\\hline \\\\ \n'); ip = nvx+1; for i=1:nvn + idx = strmatch(options_.varobs(estim_params_.var_endo(i,1),:),M_.endo_names); fprintf(fidTeX,'$%s$ & %4s & %7.3f & %6.4f & %8.4f & %7.4f \\\\ \n',... - deblank(options_.varobs_TeX(estim_params_.var_endo(i,1),:)), ... + deblank(M_.endo_names_tex(idx,:)), ... deblank(pnames(bayestopt_.pshape(ip)+1,:)), ... bayestopt_.pmean(ip), ... estim_params_.var_endo(i,7),... @@ -783,357 +784,363 @@ if ~((any(bayestopt_.pshape > 0) & options_.mh_replic) | (any(bayestopt_.pshape end end hh = figure('Name','Smoothed shocks'); - set(0,'CurrentFigure',hh) - NAMES = []; - if options_.TeX, TeXNAMES = [], end - for i=1:M_.exo_nbr-(nbplt-1)*nstar - k = (nbplt-1)*nstar+i; - if lr ~= 0 - subplot(lr,lc,i); - else - subplot(nr,nc,i); - end - plot([1 gend],[0 0],'-r','linewidth',0.5) - hold on - plot(1:gend,innov(k,:),'-k','linewidth',1) - hold off - name = deblank(M_.exo_names(k,:)); - NAMES = strvcat(NAMES,name); - if ~isempty(options_.XTick) - set(gca,'XTick',options_.XTick) - set(gca,'XTickLabel',options_.XTickLabel) - end - xlim([1 gend]) - if options_.TeX - texname = M_.exo_names_tex(k,:); - TeXNAMES = strvcat(TeXNAMES,['$ ' deblank(texname) ' $']); - end - title(name,'Interpreter','none') - eval(['oo_.SmoothedShocks.' deblank(name) ' = innov(k,:)'';']); - end - eval(['print -depsc2 ' M_.fname '_SmoothedShocks' int2str(nbplt)]); - eval(['print -dpdf ' M_.fname '_SmoothedShocks' int2str(nbplt)]); - saveas(hh,[M_.fname '_SmoothedShocks' int2str(nbplt) '.fig']); - if options_.nograph, close(hh), end - if options_.TeX - fprintf(fidTeX,'\\begin{figure}[H]\n'); - for jj = 1:size(NAMES,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_SmoothedShocks%s}\n',M_.fname,int2str(nbplt)); - fprintf(fidTeX,'\\caption{Smoothed shocks.}'); - fprintf(fidTeX,'\\label{Fig:SmoothedShocks:%s}\n',int2str(nbplt)); - fprintf(fidTeX,'\\end{figure}\n'); - fprintf(fidTeX,'\n'); - fprintf(fidTeX,'%% End of TeX file.\n'); - fclose(fidTeX); - end - end - %% - %% Smooth observational errors... - %% - yf = zeros(gend,n_varobs); - if options_.prefilter == 1 - yf = atT(bayestopt_.mf,:)+repmat(transpose(bayestopt_.mean_varobs),1,gend); - elseif options_.loglinear == 1 - yf = atT(bayestopt_.mf,:)+repmat(log(ys(bayestopt_.mfys)),1,gend)+... - trend_coeff*[1:gend]; - else - yf = atT(bayestopt_.mf,:)+repmat(ys(bayestopt_.mfys),1,gend)+... - trend_coeff*[1:gend]; - end - if nvn - number_of_plots_to_draw = 0; - index = []; - for i=1:n_varobs - if max(abs(measurement_error(10:end))) > 0.000000001 - number_of_plots_to_draw = number_of_plots_to_draw + 1; - index = cat(1,index,i); - end - eval(['oo_.SmoothedMeasurementErrors.' deblank(options_.varobs(i,:)) ... - ' = measurement_error(i,:)'';']); - end - [nbplt,nr,nc,lr,lc,nstar] = pltorg(number_of_plots_to_draw); - if options_.TeX - fidTeX = fopen([M_.fname '_SmoothedObservationErrors.TeX'],'w'); - fprintf(fidTeX,'%% TeX eps-loader file generated by dynare_estimation.m (Dynare).\n'); - fprintf(fidTeX,['%% ' datestr(now,0) '\n']); - fprintf(fidTeX,' \n'); - end - if nbplt == 1 - hh = figure('Name','Smoothed observation errors'); - set(0,'CurrentFigure',hh) - NAMES = []; - if options_.TeX, TeXNAMES = [], end - for i=1:number_of_plots_to_draw - subplot(nr,nc,i); - plot(1:gend,measurement_error(index(i),:),'-k','linewidth',1) - hold on - plot([1 gend],[0 0],'-r','linewidth',.5) - hold off - name = deblank(options_.varobs(index(i),:)); - NAMES = strvcat(NAMES,name); - if ~isempty(options_.XTick) - set(gca,'XTick',options_.XTick) - set(gca,'XTickLabel',options_.XTickLabel) - end - if options_.TeX - texname = options_.varobs_TeX(index(i),:); - TeXNAMES = strvcat(TeXNAMES,['$ ' deblank(texname) ' $']); - end - title(name,'Interpreter','none') - end - eval(['print -depsc2 ' M_.fname '_SmoothedObservationErrors' int2str(1)]); - eval(['print -dpdf ' M_.fname '_SmoothedObservationErrors' int2str(1)]); - saveas(hh,[M_.fname '_SmoothedObservationErrors' int2str(1) '.fig']); - if options_.nograph, close(hh), end - if options_.TeX - fprintf(fidTeX,'\\begin{figure}[H]\n'); - for jj = 1:number_of_plots_to_draw - 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_SmoothedObservationErrors%s}\n',M_.fname,int2str(1)); - fprintf(fidTeX,'\\caption{Smoothed observation errors.}'); - fprintf(fidTeX,'\\label{Fig:SmoothedObservationErrors:%s',int2str(1)); - fprintf(fidTeX,'\\end{figure}\n'); - fprintf(fidTeX,'\n'); - fprintf(fidTeX,'%% End of TeX file.\n'); - fclose(fidTeX); - end - else - for plt = 1:nbplt-1 - hh = figure('Name','Smoothed observation errors'); - set(0,'CurrentFigure',hh) - NAMES = []; - if options_.TeX, TeXNAMES = [], end - for i=1:nstar - k = (plt-1)*nstar+i; - subplot(nr,nc,i); - plot([1 gend],[0 0],'-r','linewidth',.5) - hold on - plot(1:gend,measurement_error(index(k),:),'-k','linewidth',1) - hold off - name = deblank(options_.varobs(index(k),:)); - NAMES = strvcat(NAMES,name); - if ~isempty(options_.XTick) - set(gca,'XTick',options_.XTick) - set(gca,'XTickLabel',options_.XTickLabel) - end - if options_.TeX - texname = options_.varobs_TeX(k,:); - TeXNAMES = strvcat(TeXNAMES,['$ ' deblank(texname) ' $']); - end - title(name,'Interpreter','none') - end - eval(['print -depsc2 ' M_.fname '_SmoothedObservationErrors' int2str(plt)]); - eval(['print -dpdf ' M_.fname '_SmoothedObservationErrors' int2str(plt)]); - saveas(hh,[M_.fname '_SmoothedObservationErrors' int2str(plt) '.fig']); - if options_.nograph, close(hh), end - if options_.TeX - fprintf(fidTeX,'\\begin{figure}[H]\n'); - for jj = 1:nstar - 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_SmoothedObservationErrors%s}\n',M_.fname,int2str(plt)); - fprintf(fidTeX,'\\caption{Smoothed observation errors.}'); - fprintf(fidTeX,'\\label{Fig:SmoothedObservationErrors:%s}\n',int2str(plt)); - fprintf(fidTeX,'\\end{figure}\n'); - fprintf(fidTeX,'\n'); - end - end - hh = figure('Name','Smoothed observation errors'); - set(0,'CurrentFigure',hh) - NAMES = []; - if options_.TeX, TeXNAMES = [], end - for i=1:number_of_plots_to_draw-(nbplt-1)*nstar - k = (nbplt-1)*nstar+i; - if lr ~= 0 - subplot(lr,lc,i); - else - subplot(nr,nc,i); - end - plot([1 gend],[0 0],'-r','linewidth',0.5) - hold on - plot(1:gend,measurement_error(index(k),:),'-k','linewidth',1) - hold off - name = deblank(options_.varobs(index(k),:)); - NAMES = strvcat(NAMES,name); - if ~isempty(options_.XTick) - set(gca,'XTick',options_.XTick) - set(gca,'XTickLabel',options_.XTickLabel) - end - if options_.TeX - texname = options_.varobs_TeX(index(k),:); - TeXNAMES = strvcat(TeXNAMES,['$ ' deblank(texname) ' $']); - end - title(name,'Interpreter','none'); - end - eval(['print -depsc2 ' M_.fname '_SmoothedObservationErrors' int2str(nbplt)]); - eval(['print -dpdf ' M_.fname '_SmoothedObservationErrors' int2str(nbplt)]); - saveas(hh,[M_.fname '_SmoothedObservationErrors' int2str(nbplt) '.fig']); - if options_.nograph, close(hh), end - if options_.TeX - fprintf(fidTeX,'\\begin{figure}[H]\n'); - for jj = 1:size(NAMES,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_SmoothedObservedErrors%s}\n',M_.fname,int2str(nbplt)); - fprintf(fidTeX,'\\caption{Smoothed observed errors.}'); - fprintf(fidTeX,'\\label{Fig:SmoothedObservedErrors:%s}\n',int2str(nbplt)); - fprintf(fidTeX,'\\end{figure}\n'); - fprintf(fidTeX,'\n'); - fprintf(fidTeX,'%% End of TeX file.\n'); - fclose(fidTeX); - end - end - end - %% - %% Historical and smoothed variabes - %% - [nbplt,nr,nc,lr,lc,nstar] = pltorg(n_varobs); + set(0,'CurrentFigure',hh) + NAMES = []; + if options_.TeX, TeXNAMES = [], end + for i=1:M_.exo_nbr-(nbplt-1)*nstar + k = (nbplt-1)*nstar+i; + if lr ~= 0 + subplot(lr,lc,i); + else + subplot(nr,nc,i); + end + plot([1 gend],[0 0],'-r','linewidth',0.5) + hold on + plot(1:gend,innov(k,:),'-k','linewidth',1) + hold off + name = deblank(M_.exo_names(k,:)); + NAMES = strvcat(NAMES,name); + if ~isempty(options_.XTick) + set(gca,'XTick',options_.XTick) + set(gca,'XTickLabel',options_.XTickLabel) + end + xlim([1 gend]) + if options_.TeX + texname = M_.exo_names_tex(k,:); + TeXNAMES = strvcat(TeXNAMES,['$ ' deblank(texname) ' $']); + end + title(name,'Interpreter','none') + eval(['oo_.SmoothedShocks.' deblank(name) ' = innov(k,:)'';']); + end + eval(['print -depsc2 ' M_.fname '_SmoothedShocks' int2str(nbplt)]); + eval(['print -dpdf ' M_.fname '_SmoothedShocks' int2str(nbplt)]); + saveas(hh,[M_.fname '_SmoothedShocks' int2str(nbplt) '.fig']); + if options_.nograph, close(hh), end if options_.TeX - fidTeX = fopen([M_.fname '_HistoricalAndSmoothedVariables.TeX'],'w'); - fprintf(fidTeX,'%% TeX eps-loader file generated by dynare_estimation.m (Dynare).\n'); - fprintf(fidTeX,['%% ' datestr(now,0) '\n']); - fprintf(fidTeX,' \n'); + fprintf(fidTeX,'\\begin{figure}[H]\n'); + for jj = 1:size(NAMES,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_SmoothedShocks%s}\n',M_.fname,int2str(nbplt)); + fprintf(fidTeX,'\\caption{Smoothed shocks.}'); + fprintf(fidTeX,'\\label{Fig:SmoothedShocks:%s}\n',int2str(nbplt)); + fprintf(fidTeX,'\\end{figure}\n'); + fprintf(fidTeX,'\n'); + fprintf(fidTeX,'%% End of TeX file.\n'); + fclose(fidTeX); end + end + %% + %% Smooth observational errors... + %% + yf = zeros(gend,n_varobs); + if options_.prefilter == 1 + yf = atT(bayestopt_.mf,:)+repmat(transpose(bayestopt_.mean_varobs),1,gend); + elseif options_.loglinear == 1 + yf = atT(bayestopt_.mf,:)+repmat(log(ys(bayestopt_.mfys)),1,gend)+... + trend_coeff*[1:gend]; + else + yf = atT(bayestopt_.mf,:)+repmat(ys(bayestopt_.mfys),1,gend)+... + trend_coeff*[1:gend]; + end + if nvn + number_of_plots_to_draw = 0; + index = []; + for i=1:n_varobs + if max(abs(measurement_error(10:end))) > 0.000000001 + number_of_plots_to_draw = number_of_plots_to_draw + 1; + index = cat(1,index,i); + end + eval(['oo_.SmoothedMeasurementErrors.' deblank(options_.varobs(i,:)) ... + ' = measurement_error(i,:)'';']); + end + [nbplt,nr,nc,lr,lc,nstar] = pltorg(number_of_plots_to_draw); + if options_.TeX + fidTeX = fopen([M_.fname '_SmoothedObservationErrors.TeX'],'w'); + fprintf(fidTeX,'%% TeX eps-loader file generated by dynare_estimation.m (Dynare).\n'); + fprintf(fidTeX,['%% ' datestr(now,0) '\n']); + fprintf(fidTeX,' \n'); + end if nbplt == 1 - hh = figure('Name','Historical and smoothed variables'); - NAMES = []; - if options_.TeX, TeXNAMES = [], end - for i=1:n_varobs - subplot(nr,nc,i); - plot(1:gend,yf(i,:),'-r','linewidth',1) - hold on - plot(1:gend,rawdata(:,i),'-k','linewidth',1) - hold off - name = deblank(options_.varobs(i,:)); - NAMES = strvcat(NAMES,name); - if ~isempty(options_.XTick) - set(gca,'XTick',options_.XTick) - set(gca,'XTickLabel',options_.XTickLabel) - end - xlim([1 gend]) - if options_.TeX - texname = options_.varobs_TeX(i,1); - TeXNAMES = strvcat(TeXNAMES,['$ ' deblank(texname) ' $']); - end - title(name,'Interpreter','none') - end - eval(['print -depsc2 ' M_.fname '_HistoricalAndSmoothedVariables' int2str(1)]); - eval(['print -dpdf ' M_.fname '_HistoricalAndSmoothedVariables' int2str(1)]); - saveas(hh,[M_.fname '_HistoricalAndSmoothedVariables' int2str(1) '.fig']); - if options_.nograph, close(hh), end - if options_.TeX - fprintf(fidTeX,'\\begin{figure}[H]\n'); - for jj = 1:n_varobs - 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_HistoricalAndSmoothedVariables%s}\n',M_.fname,int2str(1)); - fprintf(fidTeX,'\\caption{Historical and smoothed variables.}'); - fprintf(fidTeX,'\\label{Fig:HistoricalAndSmoothedVariables:%s}\n',int2str(1)); - fprintf(fidTeX,'\\end{figure}\n'); - fprintf(fidTeX,'\n'); - fprintf(fidTeX,'%% End of TeX file.\n'); - fclose(fidTeX); - end + hh = figure('Name','Smoothed observation errors'); + set(0,'CurrentFigure',hh) + NAMES = []; + if options_.TeX, TeXNAMES = [], end + for i=1:number_of_plots_to_draw + subplot(nr,nc,i); + plot(1:gend,measurement_error(index(i),:),'-k','linewidth',1) + hold on + plot([1 gend],[0 0],'-r','linewidth',.5) + hold off + name = deblank(options_.varobs(index(i),:)); + NAMES = strvcat(NAMES,name); + if ~isempty(options_.XTick) + set(gca,'XTick',options_.XTick) + set(gca,'XTickLabel',options_.XTickLabel) + end + if options_.TeX + idx = strmatch(options_.varobs(indx(i),:),M_.endo_names,'exact'); + texname = M_.endo_names_tex(idx,:); + TeXNAMES = strvcat(TeXNAMES,['$ ' deblank(texname) ' $']); + end + title(name,'Interpreter','none') + end + eval(['print -depsc2 ' M_.fname '_SmoothedObservationErrors' int2str(1)]); + eval(['print -dpdf ' M_.fname '_SmoothedObservationErrors' int2str(1)]); + saveas(hh,[M_.fname '_SmoothedObservationErrors' int2str(1) '.fig']); + if options_.nograph, close(hh), end + if options_.TeX + fprintf(fidTeX,'\\begin{figure}[H]\n'); + for jj = 1:number_of_plots_to_draw + 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_SmoothedObservationErrors%s}\n',M_.fname,int2str(1)); + fprintf(fidTeX,'\\caption{Smoothed observation errors.}'); + fprintf(fidTeX,'\\label{Fig:SmoothedObservationErrors:%s',int2str(1)); + fprintf(fidTeX,'\\end{figure}\n'); + fprintf(fidTeX,'\n'); + fprintf(fidTeX,'%% End of TeX file.\n'); + fclose(fidTeX); + end else - for plt = 1:nbplt-1 - hh = figure('Name','Historical and smoothed variables'); - set(0,'CurrentFigure',hh) - NAMES = []; - if options_.TeX, TeXNAMES = [], end - for i=1:nstar - k = (plt-1)*nstar+i; - subplot(nr,nc,i); - plot(1:gend,yf(k,:),'-r','linewidth',1) - hold on - plot(1:gend,rawdata(:,k),'-k','linewidth',1) - hold off - name = deblank(options_.varobs(k,:)); - NAMES = strvcat(NAMES,name); - if ~isempty(options_.XTick) - set(gca,'XTick',options_.XTick) - set(gca,'XTickLabel',options_.XTickLabel) - end - xlim([1 gend]) - if options_.TeX - texname = options_.varobs_TeX(k,:); - TeXNAMES = strvcat(TeXNAMES,['$ ' deblank(texname) ' $']); - end - title(name,'Interpreter','none') - end - eval(['print -depsc2 ' M_.fname '_HistoricalAndSmoothedVariables' int2str(plt)]); - eval(['print -dpdf ' M_.fname '_HistoricalAndSmoothedVariables' int2str(plt)]); - saveas(hh,[M_.fname '_HistoricalAndSmoothedVariables' int2str(plt) '.fig']); - if options_.nograph, close(hh), end - if options_.TeX - fprintf(fidTeX,'\\begin{figure}[H]\n'); - for jj = 1:nstar - 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_HistoricalAndSmoothedVariables%s}\n',M_.fname,int2str(plt)); - fprintf(fidTeX,'\\caption{Historical and smoothed variables.}'); - fprintf(fidTeX,'\\label{Fig:HistoricalAndSmoothedVariables:%s}\n',int2str(plt)); - fprintf(fidTeX,'\\end{figure}\n'); - fprintf(fidTeX,'\n'); - end - end - hh = figure('Name','Historical and smoothed variables'); - set(0,'CurrentFigure',hh) - NAMES = []; - if options_.TeX, TeXNAMES = [], end - for i=1:n_varobs-(nbplt-1)*nstar - k = (nbplt-1)*nstar+i; - if lr ~= 0 - subplot(lr,lc,i); - else - subplot(nr,nc,i); - end - plot(1:gend,yf(k,:),'-r','linewidth',1) - hold on - plot(1:gend,rawdata(:,k),'-k','linewidth',1) - hold off - name = deblank(options_.varobs(k,:)); - NAMES = strvcat(NAMES,name); - if ~isempty(options_.XTick) - set(gca,'XTick',options_.XTick) - set(gca,'XTickLabel',options_.XTickLabel) - end - xlim([1 gend]) - if options_.TeX - texname = options_.varobs_TeX(k,:); - TeXNAMES = strvcat(TeXNAMES,['$ ' deblank(texname) ' $']); - end - title(name,'Interpreter','none'); - end - eval(['print -depsc2 ' M_.fname '_HistoricalAndSmoothedVariables' int2str(nbplt)]); - eval(['print -dpdf ' M_.fname '_HistoricalAndSmoothedVariables' int2str(nbplt)]); - saveas(hh,[M_.fname '_HistoricalAndSmoothedVariables' int2str(nbplt) '.fig']); - if options_.nograph, close(hh), end - if options_.TeX - fprintf(fidTeX,'\\begin{figure}[H]\n'); - for jj = 1:size(NAMES,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_HistoricalAndSmoothedVariables%s}\n',M_.fname,int2str(nbplt)); - fprintf(fidTeX,'\\caption{Historical and smoothed variables.}'); - fprintf(fidTeX,'\\label{Fig:HistoricalAndSmoothedVariables:%s}\n',int2str(nbplt)); - fprintf(fidTeX,'\\end{figure}\n'); - fprintf(fidTeX,'\n'); - fprintf(fidTeX,'%% End of TeX file.\n'); - fclose(fidTeX); - end - end + for plt = 1:nbplt-1 + hh = figure('Name','Smoothed observation errors'); + set(0,'CurrentFigure',hh) + NAMES = []; + if options_.TeX, TeXNAMES = [], end + for i=1:nstar + k = (plt-1)*nstar+i; + subplot(nr,nc,i); + plot([1 gend],[0 0],'-r','linewidth',.5) + hold on + plot(1:gend,measurement_error(index(k),:),'-k','linewidth',1) + hold off + name = deblank(options_.varobs(index(k),:)); + NAMES = strvcat(NAMES,name); + if ~isempty(options_.XTick) + set(gca,'XTick',options_.XTick) + set(gca,'XTickLabel',options_.XTickLabel) + end + if options_.TeX + idx = strmatch(options_.varobs(k),M_.endo_names,'exact'); + texname = M_.endo_names_tex(idx,:); + TeXNAMES = strvcat(TeXNAMES,['$ ' deblank(texname) ' $']); + end + title(name,'Interpreter','none') + end + eval(['print -depsc2 ' M_.fname '_SmoothedObservationErrors' int2str(plt)]); + eval(['print -dpdf ' M_.fname '_SmoothedObservationErrors' int2str(plt)]); + saveas(hh,[M_.fname '_SmoothedObservationErrors' int2str(plt) '.fig']); + if options_.nograph, close(hh), end + if options_.TeX + fprintf(fidTeX,'\\begin{figure}[H]\n'); + for jj = 1:nstar + 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_SmoothedObservationErrors%s}\n',M_.fname,int2str(plt)); + fprintf(fidTeX,'\\caption{Smoothed observation errors.}'); + fprintf(fidTeX,'\\label{Fig:SmoothedObservationErrors:%s}\n',int2str(plt)); + fprintf(fidTeX,'\\end{figure}\n'); + fprintf(fidTeX,'\n'); + end + end + hh = figure('Name','Smoothed observation errors'); + set(0,'CurrentFigure',hh) + NAMES = []; + if options_.TeX, TeXNAMES = [], end + for i=1:number_of_plots_to_draw-(nbplt-1)*nstar + k = (nbplt-1)*nstar+i; + if lr ~= 0 + subplot(lr,lc,i); + else + subplot(nr,nc,i); + end + plot([1 gend],[0 0],'-r','linewidth',0.5) + hold on + plot(1:gend,measurement_error(index(k),:),'-k','linewidth',1) + hold off + name = deblank(options_.varobs(index(k),:)); + NAMES = strvcat(NAMES,name); + if ~isempty(options_.XTick) + set(gca,'XTick',options_.XTick) + set(gca,'XTickLabel',options_.XTickLabel) + end + if options_.TeX + idx = strmatch(options_.varobs(index(k)),M_.endo_names,'exact'); + texname = M_.endo_names_tex(idx,:); + TeXNAMES = strvcat(TeXNAMES,['$ ' deblank(texname) ' $']); + end + title(name,'Interpreter','none'); + end + eval(['print -depsc2 ' M_.fname '_SmoothedObservationErrors' int2str(nbplt)]); + eval(['print -dpdf ' M_.fname '_SmoothedObservationErrors' int2str(nbplt)]); + saveas(hh,[M_.fname '_SmoothedObservationErrors' int2str(nbplt) '.fig']); + if options_.nograph, close(hh), end + if options_.TeX + fprintf(fidTeX,'\\begin{figure}[H]\n'); + for jj = 1:size(NAMES,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_SmoothedObservedErrors%s}\n',M_.fname,int2str(nbplt)); + fprintf(fidTeX,'\\caption{Smoothed observed errors.}'); + fprintf(fidTeX,'\\label{Fig:SmoothedObservedErrors:%s}\n',int2str(nbplt)); + fprintf(fidTeX,'\\end{figure}\n'); + fprintf(fidTeX,'\n'); + fprintf(fidTeX,'%% End of TeX file.\n'); + fclose(fidTeX); + end + end + end + %% + %% Historical and smoothed variabes + %% + [nbplt,nr,nc,lr,lc,nstar] = pltorg(n_varobs); + if options_.TeX + fidTeX = fopen([M_.fname '_HistoricalAndSmoothedVariables.TeX'],'w'); + fprintf(fidTeX,'%% TeX eps-loader file generated by dynare_estimation.m (Dynare).\n'); + fprintf(fidTeX,['%% ' datestr(now,0) '\n']); + fprintf(fidTeX,' \n'); + end + if nbplt == 1 + hh = figure('Name','Historical and smoothed variables'); + NAMES = []; + if options_.TeX, TeXNAMES = [], end + for i=1:n_varobs + subplot(nr,nc,i); + plot(1:gend,yf(i,:),'-r','linewidth',1) + hold on + plot(1:gend,rawdata(:,i),'-k','linewidth',1) + hold off + name = deblank(options_.varobs(i,:)); + NAMES = strvcat(NAMES,name); + if ~isempty(options_.XTick) + set(gca,'XTick',options_.XTick) + set(gca,'XTickLabel',options_.XTickLabel) + end + xlim([1 gend]) + if options_.TeX + idx = strmatch(options_.varobs(i),M_.endo_names,'exact'); + texname = M_.endo_names_tex(idx,:); + TeXNAMES = strvcat(TeXNAMES,['$ ' deblank(texname) ' $']); + end + title(name,'Interpreter','none') + end + eval(['print -depsc2 ' M_.fname '_HistoricalAndSmoothedVariables' int2str(1)]); + eval(['print -dpdf ' M_.fname '_HistoricalAndSmoothedVariables' int2str(1)]); + saveas(hh,[M_.fname '_HistoricalAndSmoothedVariables' int2str(1) '.fig']); + if options_.nograph, close(hh), end + if options_.TeX + fprintf(fidTeX,'\\begin{figure}[H]\n'); + for jj = 1:n_varobs + 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_HistoricalAndSmoothedVariables%s}\n',M_.fname,int2str(1)); + fprintf(fidTeX,'\\caption{Historical and smoothed variables.}'); + fprintf(fidTeX,'\\label{Fig:HistoricalAndSmoothedVariables:%s}\n',int2str(1)); + fprintf(fidTeX,'\\end{figure}\n'); + fprintf(fidTeX,'\n'); + fprintf(fidTeX,'%% End of TeX file.\n'); + fclose(fidTeX); + end + else + for plt = 1:nbplt-1 + hh = figure('Name','Historical and smoothed variables'); + set(0,'CurrentFigure',hh) + NAMES = []; + if options_.TeX, TeXNAMES = [], end + for i=1:nstar + k = (plt-1)*nstar+i; + subplot(nr,nc,i); + plot(1:gend,yf(k,:),'-r','linewidth',1) + hold on + plot(1:gend,rawdata(:,k),'-k','linewidth',1) + hold off + name = deblank(options_.varobs(k,:)); + NAMES = strvcat(NAMES,name); + if ~isempty(options_.XTick) + set(gca,'XTick',options_.XTick) + set(gca,'XTickLabel',options_.XTickLabel) + end + xlim([1 gend]) + if options_.TeX + idx = strmatch(options_.varobs(k),M_.endo_names,'exact'); + texname = M_.endo_names_tex(idx,:); + TeXNAMES = strvcat(TeXNAMES,['$ ' deblank(texname) ' $']); + end + title(name,'Interpreter','none') + end + eval(['print -depsc2 ' M_.fname '_HistoricalAndSmoothedVariables' int2str(plt)]); + eval(['print -dpdf ' M_.fname '_HistoricalAndSmoothedVariables' int2str(plt)]); + saveas(hh,[M_.fname '_HistoricalAndSmoothedVariables' int2str(plt) '.fig']); + if options_.nograph, close(hh), end + if options_.TeX + fprintf(fidTeX,'\\begin{figure}[H]\n'); + for jj = 1:nstar + 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_HistoricalAndSmoothedVariables%s}\n',M_.fname,int2str(plt)); + fprintf(fidTeX,'\\caption{Historical and smoothed variables.}'); + fprintf(fidTeX,'\\label{Fig:HistoricalAndSmoothedVariables:%s}\n',int2str(plt)); + fprintf(fidTeX,'\\end{figure}\n'); + fprintf(fidTeX,'\n'); + end + end + hh = figure('Name','Historical and smoothed variables'); + set(0,'CurrentFigure',hh) + NAMES = []; + if options_.TeX, TeXNAMES = [], end + for i=1:n_varobs-(nbplt-1)*nstar + k = (nbplt-1)*nstar+i; + if lr ~= 0 + subplot(lr,lc,i); + else + subplot(nr,nc,i); + end + plot(1:gend,yf(k,:),'-r','linewidth',1) + hold on + plot(1:gend,rawdata(:,k),'-k','linewidth',1) + hold off + name = deblank(options_.varobs(k,:)); + NAMES = strvcat(NAMES,name); + if ~isempty(options_.XTick) + set(gca,'XTick',options_.XTick) + set(gca,'XTickLabel',options_.XTickLabel) + end + xlim([1 gend]) + if options_.TeX + idx = strmatch(options_.varobs(i),M_.endo_names,'exact'); + texname = M_.endo_names_tex(idx,:); + TeXNAMES = strvcat(TeXNAMES,['$ ' deblank(texname) ' $']); + end + title(name,'Interpreter','none'); + end + eval(['print -depsc2 ' M_.fname '_HistoricalAndSmoothedVariables' int2str(nbplt)]); + eval(['print -dpdf ' M_.fname '_HistoricalAndSmoothedVariables' int2str(nbplt)]); + saveas(hh,[M_.fname '_HistoricalAndSmoothedVariables' int2str(nbplt) '.fig']); + if options_.nograph, close(hh), end + if options_.TeX + fprintf(fidTeX,'\\begin{figure}[H]\n'); + for jj = 1:size(NAMES,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_HistoricalAndSmoothedVariables%s}\n',M_.fname,int2str(nbplt)); + fprintf(fidTeX,'\\caption{Historical and smoothed variables.}'); + fprintf(fidTeX,'\\label{Fig:HistoricalAndSmoothedVariables:%s}\n',int2str(nbplt)); + fprintf(fidTeX,'\\end{figure}\n'); + fprintf(fidTeX,'\n'); + fprintf(fidTeX,'%% End of TeX file.\n'); + fclose(fidTeX); + end + end end % <-- if ML estimation, posterior mode without metropolis-hastings or metropolis - % without bayesian posterior forecasts. + % without bayesian posterior forecasts. % SA 07-31-2004 * Added TeX output. % * Prior plots are done by calling plot_priors.m.