77 lines
2.0 KiB
Matlab
77 lines
2.0 KiB
Matlab
function forecast_graphs(var_list)
|
|
|
|
global M_ oo_ options_
|
|
|
|
nc = 4;
|
|
nr = 3;
|
|
exo_nbr = M_.exo_nbr;
|
|
endo_names = M_.endo_names;
|
|
fname = M_.fname;
|
|
% $$$ varobs = options_.varobs;
|
|
% $$$ y = oo_.SmoothedVariables;
|
|
% $$$ ys = oo_.dr.ys;
|
|
% $$$ gend = size(y,2);
|
|
yf = oo_.forecast.Mean;
|
|
hpdinf = oo_.forecast.HPDinf;
|
|
hpdsup = oo_.forecast.HPDsup;
|
|
if isempty(var_list)
|
|
varlist = endo_names;
|
|
i_var = 1:M_.endo_nbr;
|
|
else
|
|
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
|
|
end
|
|
nvar = length(i_var);
|
|
|
|
% $$$ % build trend for smoothed variables if necessary
|
|
% $$$ trend = zeros(size(varobs,1),10);
|
|
% $$$ if isfield(oo_.Smoother,'TrendCoeffs')
|
|
% $$$ trend_coeffs = oo_.Smoother.TrendCoeffs;
|
|
% $$$ trend = trend_coeffs*(gend-9:gend);
|
|
% $$$ end
|
|
|
|
% create subdirectory <fname>/graphs if id doesn't exist
|
|
if ~exist([fname '/graphs'])
|
|
mkdir(fname,'graphs');
|
|
end
|
|
|
|
m = 1;
|
|
n_fig = 1;
|
|
figure('Name','Forecasts (I)')
|
|
for j= 1:nvar
|
|
if m > nc*nr;
|
|
eval(['print -depsc ' fname '/graphs/forcst' int2str(n_fig) ...
|
|
'.eps;'])
|
|
n_fig =n_fig+1;
|
|
eval(['figure(''Name'',''Forecast (' int2str(n_fig) ')'');']);
|
|
m = 1;
|
|
end
|
|
subplot(nr,nc,m);
|
|
vn = deblank(endo_names(i_var(j),:));
|
|
obs = 0;
|
|
% $$$ k = strmatch(vn,varobs,'exact');
|
|
% $$$ 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
|
|
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');
|
|
hold off
|
|
m = m + 1;
|
|
end
|
|
|
|
if m > 1
|
|
eval(['print -deps ' fname '/graphs/forcst' int2str(n_fig) '.eps;'])
|
|
end |