0001 function plot_icforecast(Variables,periods,options_)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 if exist('OCTAVE_VERSION') && octave_ver_less_than('3.4.0')
0031
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)
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