shock_decomposition: move fig_names to fig_name (fixing typo)
parent
e5f1d20221
commit
c467c92d29
|
@ -31,7 +31,7 @@ function WriteShockDecomp2Excel(z,shock_names,endo_names,i_var,initial_date,Dyna
|
|||
SteadyState=[];
|
||||
fig_mode='';
|
||||
fig_mode1='';
|
||||
fig_names='';
|
||||
fig_name='';
|
||||
screen_shocks=0;
|
||||
use_shock_groups = DynareOptions.use_shock_groups;
|
||||
if use_shock_groups
|
||||
|
@ -58,15 +58,15 @@ if nargin==8 ,
|
|||
screen_shocks = opts_decomp.screen_shocks;
|
||||
end
|
||||
end
|
||||
if isfield(opts_decomp,'fig_names')
|
||||
fig_names = opts_decomp.fig_names;
|
||||
% fig_names = ['_' fig_names];
|
||||
fig_names1 = [fig_names];
|
||||
fig_names = [fig_names '_'];
|
||||
if isfield(opts_decomp,'fig_name')
|
||||
fig_name = opts_decomp.fig_name;
|
||||
% fig_name = ['_' fig_name];
|
||||
fig_name1 = [fig_name];
|
||||
fig_name = [fig_name '_'];
|
||||
end
|
||||
if screen_shocks
|
||||
fig_names1 = [fig_names1 '_screen'];
|
||||
fig_names = [fig_names 'screen_'];
|
||||
fig_name1 = [fig_name1 '_screen'];
|
||||
fig_name = [fig_name 'screen_'];
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -115,9 +115,9 @@ for j=1:nvar
|
|||
|
||||
warning off
|
||||
if ~ismac
|
||||
[STATUS,MESSAGE] = xlswrite([DynareModel.fname,'_shock_decomposition',fig_mode,fig_names1],d0,deblank(endo_names(i_var(j),:)));
|
||||
[STATUS,MESSAGE] = xlswrite([DynareModel.fname,'_shock_decomposition',fig_mode,fig_name1],d0,deblank(endo_names(i_var(j),:)));
|
||||
else
|
||||
[STATUS] = xlwrite([DynareModel.fname,'_shock_decomposition',fig_mode,fig_names1],d0,deblank(endo_names(i_var(j),:)));
|
||||
[STATUS] = xlwrite([DynareModel.fname,'_shock_decomposition',fig_mode,fig_name1],d0,deblank(endo_names(i_var(j),:)));
|
||||
end
|
||||
warning on
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ end
|
|||
% define expanded group
|
||||
label = mydata.shock_group.label;
|
||||
shocks = mydata.shock_group.shocks;
|
||||
options.shock_decomp.fig_names = [mydata.fig_names '. Expand'];
|
||||
options.shock_decomp.fig_name = [mydata.fig_name '. Expand'];
|
||||
options.use_shock_groups = strrep(label,' ','_'); %[use_shock_groups_old int2str(ic)];
|
||||
for j=1:length(shocks)
|
||||
M.shock_groups.(options.use_shock_groups).(['group' int2str(j)]).label=shocks{j};
|
||||
|
|
|
@ -11,7 +11,7 @@ function global_initialization()
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2003-2016 Dynare Team
|
||||
% Copyright (C) 2003-2017 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -724,7 +724,7 @@ options_.parameter_set = [];
|
|||
options_.use_shock_groups = '';
|
||||
options_.colormap = '';
|
||||
options_.shock_decomp.detail_plot=0;
|
||||
options_.shock_decomp.fig_names='';
|
||||
options_.shock_decomp.fig_name='';
|
||||
options_.shock_decomp.init_state = 0;
|
||||
options_.shock_decomp.interactive = 0;
|
||||
options_.shock_decomp.plot_end_date=[];
|
||||
|
|
|
@ -37,7 +37,7 @@ comp_nbr = size(z,2)-1;
|
|||
SteadyState=[];
|
||||
fig_mode='';
|
||||
fig_mode1='';
|
||||
% fig_names='';
|
||||
% fig_name='';
|
||||
% screen_shocks=0;
|
||||
opts_decomp = DynareOptions.shock_decomp;
|
||||
if isfield(opts_decomp,'steady_state')
|
||||
|
@ -48,7 +48,7 @@ if ~isempty(opts_decomp.type)
|
|||
fig_mode1 = ['_' fig_mode];
|
||||
fig_mode = [fig_mode '_'];
|
||||
end
|
||||
fig_names_long = opts_decomp.fig_names;
|
||||
fig_name_long = opts_decomp.fig_name;
|
||||
|
||||
use_shock_groups = DynareOptions.use_shock_groups;
|
||||
screen_shocks = opts_decomp.screen_shocks;
|
||||
|
@ -60,16 +60,16 @@ if use_shock_groups
|
|||
shock_ind = fieldnames(shock_groups);
|
||||
end
|
||||
if screen_shocks
|
||||
fig_names_long = [fig_names_long ' SCREEN'];
|
||||
fig_name_long = [fig_name_long ' SCREEN'];
|
||||
end
|
||||
|
||||
fig_names=strrep(fig_names_long, '(given ', '');
|
||||
fig_names=strrep(fig_names, '(vintage ', '');
|
||||
fig_names=regexprep(fig_names, ' ', '_');
|
||||
fig_names=strrep(fig_names, '.', '');
|
||||
fig_names=strrep(fig_names, '-', '');
|
||||
fig_names=strrep(fig_names, ')', '');
|
||||
fig_names=strrep(fig_names, '(', '');
|
||||
fig_name=strrep(fig_name_long, '(given ', '');
|
||||
fig_name=strrep(fig_name, '(vintage ', '');
|
||||
fig_name=regexprep(fig_name, ' ', '_');
|
||||
fig_name=strrep(fig_name, '.', '');
|
||||
fig_name=strrep(fig_name, '-', '');
|
||||
fig_name=strrep(fig_name, ')', '');
|
||||
fig_name=strrep(fig_name, '(', '');
|
||||
|
||||
interactive = opts_decomp.interactive;
|
||||
|
||||
|
@ -88,7 +88,7 @@ nvar = length(i_var);
|
|||
|
||||
%% write LaTeX-Header
|
||||
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
|
||||
fidTeX = fopen([GraphDirectoryName, filesep, DynareModel.fname '_shock_decomp' fig_mode1 fig_names '.tex'],'w');
|
||||
fidTeX = fopen([GraphDirectoryName, filesep, DynareModel.fname '_shock_decomp' fig_mode1 fig_name '.tex'],'w');
|
||||
fprintf(fidTeX,'%% TeX eps-loader file generated by Dynare''s graph_decomp.m.\n');
|
||||
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
|
||||
fprintf(fidTeX,' \n');
|
||||
|
@ -128,7 +128,7 @@ for j=1:nvar
|
|||
if ymax-ymin < 1e-6
|
||||
continue
|
||||
end
|
||||
fhandle = dyn_figure(DynareOptions.nodisplay,'Name',[preamble_txt fig_names_long strrep(fig_mode1, '_', ' ') ': ' deblank(endo_names(i_var(j),:)) '.'], 'PaperPositionMode', 'auto','PaperOrientation','landscape','renderermode','auto');
|
||||
fhandle = dyn_figure(DynareOptions.nodisplay,'Name',[preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': ' deblank(endo_names(i_var(j),:)) '.'], 'PaperPositionMode', 'auto','PaperOrientation','landscape','renderermode','auto');
|
||||
set(fhandle,'position' ,[50 50 1500 750])
|
||||
ax=axes('Position',[0.1 0.1 0.6 0.8],'box','on');
|
||||
% plot(ax,x(2:end),z1(end,:),'k-','LineWidth',2)
|
||||
|
@ -190,7 +190,7 @@ for j=1:nvar
|
|||
ht = text(0.3,y1+0.3*height,labels(i,:),'Interpreter','none');
|
||||
hold on
|
||||
if interactive & (~isoctave & use_shock_groups)
|
||||
mydata.fig_names = DynareOptions.shock_decomp.fig_names(2:end);
|
||||
mydata.fig_name = DynareOptions.shock_decomp.fig_name(2:end);
|
||||
mydata.use_shock_groups = DynareOptions.use_shock_groups;
|
||||
mydata.shock_group = shock_groups.(shock_ind{i});
|
||||
mydata.shock_decomp = DynareOptions.shock_decomp;
|
||||
|
@ -213,13 +213,13 @@ for j=1:nvar
|
|||
colormap(new_colormap)
|
||||
end
|
||||
hold off
|
||||
dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_names],DynareOptions.nodisplay,DynareOptions.graph_format);
|
||||
dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_name],DynareOptions.nodisplay,DynareOptions.graph_format);
|
||||
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s/graphs/%s_shock_decomposition_%s}\n',DynareModel.fname,DynareModel.fname,[deblank(endo_names(i_var(j),:)) fig_mode1 fig_names]);
|
||||
fprintf(fidTeX,'\\label{Fig:shock_decomp:%s}\n',[fig_mode deblank(endo_names(i_var(j),:)) fig_names]);
|
||||
fprintf(fidTeX,['\\caption{' preamble_txt fig_names_long strrep(fig_mode1, '_', ' ') ': $ %s $.}\n'],deblank(DynareModel.endo_names_tex(i_var(j),:)));
|
||||
fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s/graphs/%s_shock_decomposition_%s}\n',DynareModel.fname,DynareModel.fname,[deblank(endo_names(i_var(j),:)) fig_mode1 fig_name]);
|
||||
fprintf(fidTeX,'\\label{Fig:shock_decomp:%s}\n',[fig_mode deblank(endo_names(i_var(j),:)) fig_name]);
|
||||
fprintf(fidTeX,['\\caption{' preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': $ %s $.}\n'],deblank(DynareModel.endo_names_tex(i_var(j),:)));
|
||||
fprintf(fidTeX,'\\end{figure}\n');
|
||||
fprintf(fidTeX,' \n');
|
||||
end
|
||||
|
|
|
@ -32,7 +32,7 @@ GraphDirectoryName = CheckPath('graphs',DynareModel.dname);
|
|||
% interactive = 0;
|
||||
fig_mode='';
|
||||
fig_mode1='';
|
||||
% fig_names='';
|
||||
% fig_name='';
|
||||
% screen_shocks=0;
|
||||
use_shock_groups = DynareOptions.use_shock_groups;
|
||||
if use_shock_groups
|
||||
|
@ -55,23 +55,23 @@ screen_shocks = opts_decomp.screen_shocks;
|
|||
if DynareOptions.use_shock_groups | comp_nbr<=18,
|
||||
screen_shocks=0;
|
||||
end
|
||||
fig_names_long = opts_decomp.fig_names;
|
||||
% fig_names = ['_' fig_names];
|
||||
fig_name_long = opts_decomp.fig_name;
|
||||
% fig_name = ['_' fig_name];
|
||||
|
||||
if screen_shocks
|
||||
% fig_names1 = [fig_names1 '_screen'];
|
||||
fig_names_long = [fig_names_long ' SCREEN'];
|
||||
% fig_name1 = [fig_name1 '_screen'];
|
||||
fig_name_long = [fig_name_long ' SCREEN'];
|
||||
end
|
||||
|
||||
fig_names=strrep(fig_names_long, '(given ', '');
|
||||
fig_names=strrep(fig_names, '(vintage ', '');
|
||||
fig_names=regexprep(fig_names, ' ', '_');
|
||||
fig_names=strrep(fig_names, '.', '');
|
||||
fig_names=strrep(fig_names, '-', '');
|
||||
fig_names=strrep(fig_names, ')', '');
|
||||
fig_names=strrep(fig_names, '(', '');
|
||||
% fig_names1 = [fig_names];
|
||||
% fig_names = [fig_names '_'];
|
||||
fig_name=strrep(fig_name_long, '(given ', '');
|
||||
fig_name=strrep(fig_name, '(vintage ', '');
|
||||
fig_name=regexprep(fig_name, ' ', '_');
|
||||
fig_name=strrep(fig_name, '.', '');
|
||||
fig_name=strrep(fig_name, '-', '');
|
||||
fig_name=strrep(fig_name, ')', '');
|
||||
fig_name=strrep(fig_name, '(', '');
|
||||
% fig_name1 = [fig_name];
|
||||
% fig_name = [fig_name '_'];
|
||||
|
||||
gend = size(z,3);
|
||||
if isempty(initial_date)
|
||||
|
@ -106,7 +106,7 @@ nvar = length(i_var);
|
|||
|
||||
%% write LaTeX-Header
|
||||
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
|
||||
fidTeX = fopen([GraphDirectoryName, filesep, DynareModel.fname '_shock_decomp' fig_mode1 fig_names '_detail.tex'],'w');
|
||||
fidTeX = fopen([GraphDirectoryName, filesep, DynareModel.fname '_shock_decomp' fig_mode1 fig_name '_detail.tex'],'w');
|
||||
fprintf(fidTeX,'%% TeX eps-loader file generated by Dynare''s graph_decomp_detail.m.\n');
|
||||
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
|
||||
fprintf(fidTeX,' \n');
|
||||
|
@ -151,7 +151,7 @@ for j=1:nvar
|
|||
continue
|
||||
end
|
||||
for jf = 1:nfigs
|
||||
fhandle = dyn_figure(DynareOptions.nodisplay,'Name',[preamble_txt fig_names_long strrep(fig_mode1, '_', ' ') ': ' deblank(endo_names(i_var(j),:)) ' (detail).'],'position',[200 100 650 850], 'PaperPositionMode', 'auto','PaperOrientation','portrait','renderermode','auto');
|
||||
fhandle = dyn_figure(DynareOptions.nodisplay,'Name',[preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': ' deblank(endo_names(i_var(j),:)) ' (detail).'],'position',[200 100 650 850], 'PaperPositionMode', 'auto','PaperOrientation','portrait','renderermode','auto');
|
||||
a0=zeros(1,4);
|
||||
a0(3)=inf;
|
||||
a0(4)=-inf;
|
||||
|
@ -179,7 +179,7 @@ for j=1:nvar
|
|||
set(gca,'ylim',a0(3:4))
|
||||
hold on, h1=plot(x(2:end),z1(end,:),'k-','LineWidth',2);
|
||||
if interactive & (~isoctave & use_shock_groups)
|
||||
mydata.fig_names = DynareOptions.shock_decomp.fig_names(2:end);
|
||||
mydata.fig_name = DynareOptions.shock_decomp.fig_name(2:end);
|
||||
mydata.use_shock_groups = DynareOptions.use_shock_groups;
|
||||
mydata.shock_group = shock_groups.(shock_ind{ic});
|
||||
mydata.shock_decomp = DynareOptions.shock_decomp;
|
||||
|
@ -224,13 +224,13 @@ for j=1:nvar
|
|||
else
|
||||
suffix = ['_detail'];
|
||||
end
|
||||
dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_names suffix],DynareOptions.nodisplay,DynareOptions.graph_format);
|
||||
dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_name suffix],DynareOptions.nodisplay,DynareOptions.graph_format);
|
||||
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s/graphs/%s_shock_decomposition_%s}\n',DynareModel.fname,DynareModel.fname,[deblank(endo_names(i_var(j),:)) fig_mode1 fig_names suffix]);
|
||||
fprintf(fidTeX,'\\label{Fig:shock_decomp_detail:%s}\n',[fig_mode deblank(endo_names(i_var(j),:)) fig_names suffix]);
|
||||
fprintf(fidTeX,['\\caption{' preamble_txt fig_names_long strrep(fig_mode1, '_', ' ') ': $ %s $ (detail).}\n'],deblank(DynareModel.endo_names_tex(i_var(j),:)));
|
||||
fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s/graphs/%s_shock_decomposition_%s}\n',DynareModel.fname,DynareModel.fname,[deblank(endo_names(i_var(j),:)) fig_mode1 fig_name suffix]);
|
||||
fprintf(fidTeX,'\\label{Fig:shock_decomp_detail:%s}\n',[fig_mode deblank(endo_names(i_var(j),:)) fig_name suffix]);
|
||||
fprintf(fidTeX,['\\caption{' preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': $ %s $ (detail).}\n'],deblank(DynareModel.endo_names_tex(i_var(j),:)));
|
||||
fprintf(fidTeX,'\\end{figure}\n');
|
||||
fprintf(fidTeX,' \n');
|
||||
end
|
||||
|
|
|
@ -41,7 +41,7 @@ endo_nbr = M_.endo_nbr;
|
|||
% number of shocks
|
||||
nshocks = M_.exo_nbr;
|
||||
% type = '';
|
||||
fig_names='';
|
||||
fig_name='';
|
||||
% detail_plot=0;
|
||||
% realtime_=0; % 0 is standard; 1 is realtime (pool/vintage); 2 is conditional (pool/vintage); 3 is forecast (pool/vintage)
|
||||
% vintage_=0; % 0 pool realtime/conditional; int: forecast/conditional shock decompositions
|
||||
|
@ -55,8 +55,8 @@ else
|
|||
expand=0;
|
||||
end
|
||||
|
||||
if ~isempty(options_.shock_decomp.fig_names)
|
||||
fig_names=[' ' options_.shock_decomp.fig_names];
|
||||
if ~isempty(options_.shock_decomp.fig_name)
|
||||
fig_name=[' ' options_.shock_decomp.fig_name];
|
||||
end
|
||||
type=options_.shock_decomp.type;
|
||||
detail_plot=options_.shock_decomp.detail_plot;
|
||||
|
@ -81,35 +81,35 @@ switch realtime_
|
|||
|
||||
case 0
|
||||
z = oo_.shock_decomposition;
|
||||
fig_names1=fig_names;
|
||||
fig_name1=fig_name;
|
||||
|
||||
case 1 % realtime
|
||||
if vintage_
|
||||
z = oo_.realtime_shock_decomposition.(['time_' int2str(vintage_)]);
|
||||
fig_names1=[fig_names ' realtime (vintage ' char(initial_date+vintage_-1) ')'];
|
||||
fig_name1=[fig_name ' realtime (vintage ' char(initial_date+vintage_-1) ')'];
|
||||
else
|
||||
z = oo_.realtime_shock_decomposition.pool;
|
||||
fig_names1=[fig_names ' realtime (rolling)'];
|
||||
fig_name1=[fig_name ' realtime (rolling)'];
|
||||
end
|
||||
|
||||
case 2 % conditional
|
||||
if vintage_
|
||||
z = oo_.realtime_conditional_shock_decomposition.(['time_' int2str(vintage_)]);
|
||||
initial_date = options_.initial_date+vintage_-1;
|
||||
fig_names1=[fig_names ' ' int2str(forecast_) '-step ahead conditional forecast (given ' char(initial_date) ')'];
|
||||
fig_name1=[fig_name ' ' int2str(forecast_) '-step ahead conditional forecast (given ' char(initial_date) ')'];
|
||||
else
|
||||
z = oo_.conditional_shock_decomposition.pool;
|
||||
fig_names1=[fig_names ' 1-step ahead conditional forecast (rolling)'];
|
||||
fig_name1=[fig_name ' 1-step ahead conditional forecast (rolling)'];
|
||||
end
|
||||
|
||||
case 3 % forecast
|
||||
if vintage_
|
||||
z = oo_.realtime_forecast_shock_decomposition.(['time_' int2str(vintage_)]);
|
||||
initial_date = options_.initial_date+vintage_-1;
|
||||
fig_names1=[fig_names ' ' int2str(forecast_) '-step ahead forecast (given ' char(initial_date) ')'];
|
||||
fig_name1=[fig_name ' ' int2str(forecast_) '-step ahead forecast (given ' char(initial_date) ')'];
|
||||
else
|
||||
z = oo_.realtime_forecast_shock_decomposition.pool;
|
||||
fig_names1=[fig_names ' 1-step ahead forecast (rolling)'];
|
||||
fig_name1=[fig_name ' 1-step ahead forecast (rolling)'];
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -170,14 +170,14 @@ end
|
|||
|
||||
|
||||
if ~expand
|
||||
fig_names = fig_names1;
|
||||
fig_name = fig_name1;
|
||||
end
|
||||
gend = size(z,3);
|
||||
if options_.use_shock_groups
|
||||
shock_groups = M_.shock_groups.(options_.use_shock_groups);
|
||||
shock_ind = fieldnames(shock_groups);
|
||||
ngroups = length(shock_ind);
|
||||
fig_names=[fig_names ' group ' options_.use_shock_groups];
|
||||
fig_name=[fig_name ' group ' options_.use_shock_groups];
|
||||
shock_names = shock_ind;
|
||||
for i=1:ngroups,
|
||||
shock_names{i} = (shock_groups.(shock_ind{i}).label);
|
||||
|
@ -329,7 +329,7 @@ end
|
|||
z = z(:,:,a:b);
|
||||
% end crop data
|
||||
|
||||
options_.shock_decomp.fig_names=fig_names;
|
||||
options_.shock_decomp.fig_name=fig_name;
|
||||
if detail_plot,
|
||||
graph_decomp_detail(z,shock_names,M_.endo_names,i_var,my_initial_date,M_,options_)
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue