2009-12-16 18:17:34 +01:00
|
|
|
function forecast_graphs(var_list)
|
|
|
|
|
2013-06-12 16:42:09 +02:00
|
|
|
% Copyright (C) 2008-2013 Dynare Team
|
2009-12-16 18:17:34 +01:00
|
|
|
%
|
|
|
|
% This file is part of Dynare.
|
|
|
|
%
|
|
|
|
% Dynare is free software: you can redistribute it and/or modify
|
|
|
|
% it under the terms of the GNU General Public License as published by
|
|
|
|
% the Free Software Foundation, either version 3 of the License, or
|
|
|
|
% (at your option) any later version.
|
|
|
|
%
|
|
|
|
% Dynare is distributed in the hope that it will be useful,
|
|
|
|
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
% GNU General Public License for more details.
|
|
|
|
%
|
|
|
|
% You should have received a copy of the GNU General Public License
|
|
|
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
global M_ oo_ options_
|
|
|
|
|
|
|
|
nc = 4;
|
|
|
|
nr = 3;
|
|
|
|
exo_nbr = M_.exo_nbr;
|
|
|
|
endo_names = M_.endo_names;
|
|
|
|
fname = M_.fname;
|
|
|
|
yf = oo_.forecast.Mean;
|
|
|
|
hpdinf = oo_.forecast.HPDinf;
|
|
|
|
hpdsup = oo_.forecast.HPDsup;
|
|
|
|
if isempty(var_list)
|
|
|
|
varlist = endo_names(1:M_.orig_endo_nbr,:);
|
|
|
|
end
|
|
|
|
i_var = [];
|
|
|
|
for i = 1:size(var_list)
|
|
|
|
tmp = strmatch(var_list(i,:),endo_names,'exact');
|
|
|
|
if isempty(tmp)
|
|
|
|
error([var_list(i,:) ' isn''t and endogenous variable'])
|
|
|
|
end
|
|
|
|
i_var = [i_var; tmp];
|
|
|
|
end
|
|
|
|
nvar = length(i_var);
|
|
|
|
|
|
|
|
% create subdirectory <fname>/graphs if id doesn't exist
|
|
|
|
if ~exist(fname, 'dir')
|
|
|
|
mkdir('.',fname);
|
|
|
|
end
|
|
|
|
if ~exist([fname '/graphs'])
|
|
|
|
mkdir(fname,'graphs');
|
|
|
|
end
|
|
|
|
|
|
|
|
m = 1;
|
|
|
|
n_fig = 1;
|
2012-04-20 20:17:20 +02:00
|
|
|
hh=dyn_figure(options_,'Name','Forecasts (I)');
|
2009-12-16 18:17:34 +01:00
|
|
|
for j= 1:nvar
|
|
|
|
if m > nc*nr;
|
2012-04-20 20:17:20 +02:00
|
|
|
dyn_saveas(hh,[ fname '/graphs/forcst' int2str(n_fig)],options_);
|
|
|
|
|
2009-12-16 18:17:34 +01:00
|
|
|
n_fig =n_fig+1;
|
2013-04-26 19:57:36 +02:00
|
|
|
eval(['hh=dyn_figure(options_,''Name'',''Forecasts (' int2str(n_fig) ')'');']);
|
2009-12-16 18:17:34 +01:00
|
|
|
m = 1;
|
|
|
|
end
|
|
|
|
subplot(nr,nc,m);
|
|
|
|
vn = deblank(endo_names(i_var(j),:));
|
|
|
|
obs = 0;
|
|
|
|
% $$$ k = strmatch(vn,varobs,'exact');
|
2010-01-05 11:46:10 +01:00
|
|
|
% $$$ if ~isempty(k)
|
|
|
|
% $$$ yy = y.(vn)(end-9:end) + repmat(ys(i_var(j)),10,1)+trend(k,:)';
|
|
|
|
% $$$ plot(yy);
|
|
|
|
% $$$ hold on
|
|
|
|
% $$$ obs = 10;
|
|
|
|
% $$$ end
|
2009-12-16 18:17:34 +01:00
|
|
|
plot([NaN(obs,1); yf.(vn)]);
|
|
|
|
hold on
|
|
|
|
plot([NaN(obs,1); hpdinf.(vn)]);
|
|
|
|
hold on
|
|
|
|
plot([NaN(obs,1); hpdsup.(vn)]);
|
|
|
|
title(vn,'Interpreter','none');
|
2013-04-26 19:57:36 +02:00
|
|
|
xlim([1 obs+length(hpdsup.(vn))])
|
2009-12-16 18:17:34 +01:00
|
|
|
hold off
|
|
|
|
m = m + 1;
|
|
|
|
end
|
|
|
|
|
|
|
|
if m > 1
|
2012-04-20 20:17:20 +02:00
|
|
|
dyn_saveas(hh,[fname '/graphs/forcst' int2str(n_fig)],options_);
|
2009-12-16 18:17:34 +01:00
|
|
|
end
|