


Copyright (C) 2008-2010 Dynare Team 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/>.


0001 function forecast_graphs(var_list) 0002 0003 % Copyright (C) 2008-2010 Dynare Team 0004 % 0005 % This file is part of Dynare. 0006 % 0007 % Dynare is free software: you can redistribute it and/or modify 0008 % it under the terms of the GNU General Public License as published by 0009 % the Free Software Foundation, either version 3 of the License, or 0010 % (at your option) any later version. 0011 % 0012 % Dynare is distributed in the hope that it will be useful, 0013 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0015 % GNU General Public License for more details. 0016 % 0017 % You should have received a copy of the GNU General Public License 0018 % along with Dynare. If not, see <http://www.gnu.org/licenses/>. 0019 0020 global M_ oo_ options_ 0021 0022 nc = 4; 0023 nr = 3; 0024 exo_nbr = M_.exo_nbr; 0025 endo_names = M_.endo_names; 0026 fname = M_.fname; 0027 % $$$ varobs = options_.varobs; 0028 % $$$ y = oo_.SmoothedVariables; 0029 % $$$ ys = oo_.dr.ys; 0030 % $$$ gend = size(y,2); 0031 yf = oo_.forecast.Mean; 0032 hpdinf = oo_.forecast.HPDinf; 0033 hpdsup = oo_.forecast.HPDsup; 0034 if isempty(var_list) 0035 varlist = endo_names(1:M_.orig_endo_nbr,:); 0036 end 0037 i_var = []; 0038 for i = 1:size(var_list) 0039 tmp = strmatch(var_list(i,:),endo_names,'exact'); 0040 if isempty(tmp) 0041 error([var_list(i,:) ' isn''t and endogenous variable']) 0042 end 0043 i_var = [i_var; tmp]; 0044 end 0045 nvar = length(i_var); 0046 0047 % $$$ % build trend for smoothed variables if necessary 0048 % $$$ trend = zeros(size(varobs,1),10); 0049 % $$$ if isfield(oo_.Smoother,'TrendCoeffs') 0050 % $$$ trend_coeffs = oo_.Smoother.TrendCoeffs; 0051 % $$$ trend = trend_coeffs*(gend-9:gend); 0052 % $$$ end 0053 0054 % create subdirectory <fname>/graphs if id doesn't exist 0055 if ~exist(fname, 'dir') 0056 mkdir('.',fname); 0057 end 0058 if ~exist([fname '/graphs']) 0059 mkdir(fname,'graphs'); 0060 end 0061 0062 m = 1; 0063 n_fig = 1; 0064 hh=dyn_figure(options_,'Name','Forecasts (I)'); 0065 for j= 1:nvar 0066 if m > nc*nr; 0067 dyn_saveas(hh,[ fname '/graphs/forcst' int2str(n_fig)],options_); 0068 0069 n_fig =n_fig+1; 0070 eval(['hh=dyn_figure(options_,''Name'',''Forecast (' int2str(n_fig) ')'');']); 0071 m = 1; 0072 end 0073 subplot(nr,nc,m); 0074 vn = deblank(endo_names(i_var(j),:)); 0075 obs = 0; 0076 % $$$ k = strmatch(vn,varobs,'exact'); 0077 % $$$ if ~isempty(k) 0078 % $$$ yy = y.(vn)(end-9:end) + repmat(ys(i_var(j)),10,1)+trend(k,:)'; 0079 % $$$ plot(yy); 0080 % $$$ hold on 0081 % $$$ obs = 10; 0082 % $$$ end 0083 plot([NaN(obs,1); yf.(vn)]); 0084 hold on 0085 plot([NaN(obs,1); hpdinf.(vn)]); 0086 hold on 0087 plot([NaN(obs,1); hpdsup.(vn)]); 0088 title(vn,'Interpreter','none'); 0089 hold off 0090 m = m + 1; 0091 end 0092 0093 if m > 1 0094 dyn_saveas(hh,[fname '/graphs/forcst' int2str(n_fig)],options_); 0095 end