Home > matlab > plot_icforecast.m

plot_icforecast

PURPOSE ^

Build plots for the conditional forecasts.

SYNOPSIS ^

function plot_icforecast(Variables,periods,options_)

DESCRIPTION ^

 Build plots for the conditional forecasts.

 INPUTS 
  o Variables     [char]        m*x array holding the names of the endogenous variables to be plotted. 

 OUTPUTS
  None.
 
 SPECIAL REQUIREMENTS
  This routine has to be called after imcforecast.m.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function plot_icforecast(Variables,periods,options_)
0002 % Build plots for the conditional forecasts.
0003 %
0004 % INPUTS
0005 %  o Variables     [char]        m*x array holding the names of the endogenous variables to be plotted.
0006 %
0007 % OUTPUTS
0008 %  None.
0009 %
0010 % SPECIAL REQUIREMENTS
0011 %  This routine has to be called after imcforecast.m.
0012 
0013 % Copyright (C) 2006-2009 Dynare Team
0014 %
0015 % This file is part of Dynare.
0016 %
0017 % Dynare is free software: you can redistribute it and/or modify
0018 % it under the terms of the GNU General Public License as published by
0019 % the Free Software Foundation, either version 3 of the License, or
0020 % (at your option) any later version.
0021 %
0022 % Dynare is distributed in the hope that it will be useful,
0023 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0024 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0025 % GNU General Public License for more details.
0026 %
0027 % You should have received a copy of the GNU General Public License
0028 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0029 
0030 if exist('OCTAVE_VERSION') && octave_ver_less_than('3.4.0')
0031     % The set() command on the handle returned by area() crashes in Octave 3.2
0032     error('plot_conditional_forecast: you need Octave >= 3.4 (because of a bug in older versions)')
0033 end
0034 
0035 load conditional_forecasts;
0036 
0037 if nargin==1 || isempty(periods) % Set default number of periods.
0038     eval(['periods = length(forecasts.cond.mean.' Variables(1,:) ');']);
0039 end
0040 
0041 for i=1:size(Variables,1)
0042     eval(['ci1 = forecasts.cond.ci.' Variables(i,:) ';'])
0043     eval(['m1 = forecasts.cond.mean.' Variables(i,:) ';'])
0044     eval(['ci2 = forecasts.uncond.ci.' Variables(i,:) ';'])
0045     eval(['m2 = forecasts.uncond.mean.' Variables(i,:) ';'])
0046     build_figure(Variables(i,:),ci1(:,1:periods),ci2(:,1:periods),m1(1:periods),m2(1:periods),options_);
0047 end
0048 
0049 function build_figure(name,cci1,cci2,mm1,mm2,options_)
0050 hh = dyn_figure(options_,'Name',['Conditional forecast: ' name '.']);
0051 H = length(mm1);
0052 h1 = area(1:H,cci1(2,1:H));
0053 set(h1,'BaseValue',min([min(cci1(1,:)),min(cci2(1,:))]))
0054 set(h1,'FaceColor',[.9 .9 .9])
0055 hold on
0056 h2 = area(1:H,cci1(1,1:H));
0057 set(h2,'BaseValue',min([min(cci1(1,:)),min(cci2(1,:))]))
0058 set(h2,'FaceColor',[1 1 1])
0059 plot(1:H,mm1,'-k','linewidth',3)
0060 plot(1:H,mm2,'--k','linewidth',3)
0061 plot(1:H,cci2(1,:),'--k','linewidth',1)
0062 plot(1:H,cci2(2,:),'--k','linewidth',1)
0063 axis tight
0064 hold off

Generated on Tue 22-May-2012 02:40:23 by m2html © 2005