Posterior IRFs: only plot HPDIs when sufficient draws were generated
Otherwise a crash during plotting will happentime-shift
parent
0a2f3f0f10
commit
0c3065b39b
|
@ -105,6 +105,9 @@ delete_stale_file([MhDirectoryName filesep M_.fname '_param_irf*.mat']);
|
||||||
if strcmpi(type,'posterior')
|
if strcmpi(type,'posterior')
|
||||||
B = options_.sub_draws;
|
B = options_.sub_draws;
|
||||||
options_.B = B;
|
options_.B = B;
|
||||||
|
if round((1-options_.mh_conf_sig)*B)<2
|
||||||
|
fprintf('\nPosteriorIRF:: options_.mh_conf_sig times options_.sub_draws is too small to generate HPDIs. I am omitting them.\n')
|
||||||
|
end
|
||||||
elseif strcmpi(type,'gsa')
|
elseif strcmpi(type,'gsa')
|
||||||
RootDirectoryName = CheckPath('gsa',M_.dname);
|
RootDirectoryName = CheckPath('gsa',M_.dname);
|
||||||
if options_.opt_gsa.pprior
|
if options_.opt_gsa.pprior
|
||||||
|
|
|
@ -111,9 +111,11 @@ for i=fpar:npar,
|
||||||
set(0,'CurrentFigure',hh)
|
set(0,'CurrentFigure',hh)
|
||||||
subplot(nn,nn,subplotnum);
|
subplot(nn,nn,subplotnum);
|
||||||
if ~MAX_nirfs_dsgevar
|
if ~MAX_nirfs_dsgevar
|
||||||
|
if ~isnan(min(HPDIRF(:,1,j,i)))
|
||||||
h1 = area(1:options_.irf,HPDIRF(:,2,j,i),'FaceColor',[.9 .9 .9],'BaseValue',min(HPDIRF(:,1,j,i))); %grey below HPDIsup and minimum of HPDIinf
|
h1 = area(1:options_.irf,HPDIRF(:,2,j,i),'FaceColor',[.9 .9 .9],'BaseValue',min(HPDIRF(:,1,j,i))); %grey below HPDIsup and minimum of HPDIinf
|
||||||
hold on
|
hold on
|
||||||
h2 = area(1:options_.irf,HPDIRF(:,1,j,i),'FaceColor',[1 1 1],'BaseValue',min(HPDIRF(:,1,j,i))); %white below HPDIinf and minimum of HPDIinf
|
h2 = area(1:options_.irf,HPDIRF(:,1,j,i),'FaceColor',[1 1 1],'BaseValue',min(HPDIRF(:,1,j,i))); %white below HPDIinf and minimum of HPDIinf
|
||||||
|
end
|
||||||
plot(1:options_.irf,MeanIRF(:,j,i),'-k','linewidth',3)
|
plot(1:options_.irf,MeanIRF(:,j,i),'-k','linewidth',3)
|
||||||
% plot([1 options_.irf],[0 0],'-r','linewidth',0.5);
|
% plot([1 options_.irf],[0 0],'-r','linewidth',0.5);
|
||||||
box on
|
box on
|
||||||
|
@ -122,13 +124,17 @@ for i=fpar:npar,
|
||||||
remove_fractional_xticks;
|
remove_fractional_xticks;
|
||||||
hold off
|
hold off
|
||||||
else
|
else
|
||||||
|
if ~isnan(min([min(HPDIRF(:,1,j,i)),min(HPDIRFdsgevar(:,1,j,i))]))
|
||||||
h1 = area(1:options_.irf,HPDIRF(:,2,j,i),'FaceColor',[.9 .9 .9],'BaseValue',min([min(HPDIRF(:,1,j,i)),min(HPDIRFdsgevar(:,1,j,i))])); %grey below HPDIsup and minimum of HPDIinf and HPDIRFdsgevar
|
h1 = area(1:options_.irf,HPDIRF(:,2,j,i),'FaceColor',[.9 .9 .9],'BaseValue',min([min(HPDIRF(:,1,j,i)),min(HPDIRFdsgevar(:,1,j,i))])); %grey below HPDIsup and minimum of HPDIinf and HPDIRFdsgevar
|
||||||
hold on
|
hold on
|
||||||
h2 = area(1:options_.irf,HPDIRF(:,1,j,i),'FaceColor',[1 1 1],'BaseValue',min([min(HPDIRF(:,1,j,i)),min(HPDIRFdsgevar(:,1,j,i))])); %white below HPDIinf and minimum of HPDIinf and HPDIRFdsgevar
|
h2 = area(1:options_.irf,HPDIRF(:,1,j,i),'FaceColor',[1 1 1],'BaseValue',min([min(HPDIRF(:,1,j,i)),min(HPDIRFdsgevar(:,1,j,i))])); %white below HPDIinf and minimum of HPDIinf and HPDIRFdsgevar
|
||||||
|
end
|
||||||
plot(1:options_.irf,MeanIRF(:,j,i),'-k','linewidth',3)
|
plot(1:options_.irf,MeanIRF(:,j,i),'-k','linewidth',3)
|
||||||
plot(1:options_.irf,MeanIRFdsgevar(:,j,i),'--k','linewidth',2)
|
plot(1:options_.irf,MeanIRFdsgevar(:,j,i),'--k','linewidth',2)
|
||||||
|
if ~isnan(min(HPDIRF(:,1,j,i)))
|
||||||
plot(1:options_.irf,HPDIRFdsgevar(:,1,j,i),'--k','linewidth',1)
|
plot(1:options_.irf,HPDIRFdsgevar(:,1,j,i),'--k','linewidth',1)
|
||||||
plot(1:options_.irf,HPDIRFdsgevar(:,2,j,i),'--k','linewidth',1)
|
plot(1:options_.irf,HPDIRFdsgevar(:,2,j,i),'--k','linewidth',1)
|
||||||
|
end
|
||||||
% plot([1 options_.irf],[0 0],'-r','linewidth',0.5);
|
% plot([1 options_.irf],[0 0],'-r','linewidth',0.5);
|
||||||
box on
|
box on
|
||||||
axis tight
|
axis tight
|
||||||
|
|
Loading…
Reference in New Issue