Make BVAR obey graph-options and save to graph folder

time-shift
Johannes Pfeifer 2013-05-19 10:50:23 +02:00
parent 7bbe121769
commit 77488f5f22
4 changed files with 22 additions and 22 deletions

View File

@ -114,17 +114,18 @@ sims_with_shocks_sort = sort(sims_with_shocks, 3);
sims_with_shocks_down_conf = sims_with_shocks_sort(:, :, sort_idx(1));
sims_with_shocks_up_conf = sims_with_shocks_sort(:, :, sort_idx(2));
dynare_graph_init(sprintf('BVAR forecasts (nlags = %d)', nlags), ny, {'b-' 'g-' 'g-' 'r-' 'r-'});
OutputDirectoryName = CheckPath('graphs',M_.fname);
dyn_graph=dynare_graph_init(sprintf('BVAR forecasts (nlags = %d)', nlags), ny, {'b-' 'g-' 'g-' 'r-' 'r-'});
for i = 1:ny
dynare_graph([ sims_no_shock_median(:, i) ...
dyn_graph=dynare_graph(dyn_graph,[ sims_no_shock_median(:, i) ...
sims_no_shock_up_conf(:, i) sims_no_shock_down_conf(:, i) ...
sims_with_shocks_up_conf(:, i) sims_with_shocks_down_conf(:, i) ], ...
options_.varobs(i, :));
end
dynare_graph_close;
dyn_saveas(dyn_graph.fh,[OutputDirectoryName '/' M_.fname '_BVAR_forecast_',num2str(nlags)],options_)
% Compute RMSE

View File

@ -1,4 +1,4 @@
function dynare_graph(y,tit,x)
function dyn_graph=dynare_graph(dyn_graph,y,tit,x)
% function dynare_graph(y,tit,x)
% graphs
%
@ -7,12 +7,12 @@ function dynare_graph(y,tit,x)
% colors: line colors
%
% OUTPUT
% none
% dyn_graph: structure with figure information
%
% SPECIAL REQUIREMENT
% none
% Copyright (C) 2006-2009 Dynare Team
% Copyright (C) 2006-2013 Dynare Team
%
% This file is part of Dynare.
%
@ -29,9 +29,7 @@ function dynare_graph(y,tit,x)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global dyn_graph
if nargin < 3
if nargin < 4
x = (1:size(y,1))';
end
nplot = dyn_graph.plot_nbr + 1;

View File

@ -1,4 +1,4 @@
function dynare_graph_init(figure_name,nplot,line_types,line_width)
function dyn_graph=dynare_graph_init(figure_name,nplot,line_types,line_width)
% function dynare_graph_init(figure_name,colors)
% initializes set of graphs
%
@ -7,12 +7,12 @@ function dynare_graph_init(figure_name,nplot,line_types,line_width)
% colors: line colors
%
% OUTPUTS
% none
% dyn_graph: structure with figure information
%
% SPECIAL REQUIREMENT
% none
% Copyright (C) 2006-2009 Dynare Team
% Copyright (C) 2006-2013 Dynare Team
%
% This file is part of Dynare.
%
@ -29,9 +29,9 @@ function dynare_graph_init(figure_name,nplot,line_types,line_width)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global dyn_graph options_
global options_
dyn_graph.fh = figure('Name',figure_name);
dyn_graph.fh = dyn_figure(options_,'Name',figure_name);
dyn_graph.figure_name = figure_name;
if nargin > 2
dyn_graph.line_types = line_types;

View File

@ -15,7 +15,7 @@ function forcst_unc(y0,var_list)
% SPECIAL REQUIREMENTS
% None.
% Copyright (C) 2006-2011 Dynare Team
% Copyright (C) 2006-2013 Dynare Team
%
% This file is part of Dynare.
%
@ -129,20 +129,21 @@ yf3_1 = yf3'-[zeros(maximum_lag,n); yf3_intv];
yf3_2 = yf3'+[zeros(maximum_lag,n); yf3_intv];
% graphs
OutputDirectoryName = CheckPath('graphs',M_.fname);
dynare_graph_init('Forecasts type I',n,{'b-' 'g-' 'g-' 'r-' 'r-'});
dyn_graph=dynare_graph_init('Forecasts type I',n,{'b-' 'g-' 'g-' 'r-' 'r-'});
for i=1:n
dynare_graph([yf_mean(:,i) squeeze(yf1(:,i,k1)) squeeze(yf2(:,i,k2))],...
dynare_graph(dyn_graph,[yf_mean(:,i) squeeze(yf1(:,i,k1)) squeeze(yf2(:,i,k2))],...
var_list(i,:));
end
dynare_graph_close;
dyn_saveas(dyn_graph.fh,[OutputDirectoryName '/' M_.fname '_forecast_param_uncert_',num2str(nlags)],options_)
dynare_graph_init('Forecasts type II',n,{'b-' 'k-' 'k-' 'r-' 'r-'});
dyn_graph=dynare_graph_init('Forecasts type II',n,{'b-' 'k-' 'k-' 'r-' 'r-'});
for i=1:n
dynare_graph([yf_mean(:,i) yf3_1(:,i) yf3_2(:,i) squeeze(yf2(:,i,k2))],...
dynare_graph(dyn_graph,[yf_mean(:,i) yf3_1(:,i) yf3_2(:,i) squeeze(yf2(:,i,k2))],...
var_list(i,:));
end
dynare_graph_close;
dyn_saveas(dyn_graph.fh,[OutputDirectoryName '/' M_.fname '_forecast_param_shock_uncert_',num2str(nlags)],options_)
% saving results