Skip to content
Snippets Groups Projects
Commit 0494b92e authored by Marco Ratto's avatar Marco Ratto
Browse files

Proper handling of nograph option in gsa routines. Accordingly some more...

Proper handling of nograph option in gsa routines. Accordingly some more printed output on command window is allowed.
parent 808dade2
No related branches found
No related tags found
No related merge requests found
......@@ -286,6 +286,7 @@ else
PP(j,i)=P;
end
end
if ~options_.nograph,
ifig=0;
for i=1:size(vvarvecm,1),
if mod(i,9)==1,
......@@ -376,6 +377,7 @@ else
end
end
end
end
param_names='';
for j=1:npar+nshock,
......@@ -470,6 +472,7 @@ else
pnam=bayestopt_.name;
% plot trade-offs
if ~options_.nograph
a00=jet(size(vvarvecm,1));
for ix=1:ceil(length(nsnam)/5),
hh = dyn_figure(options_);
......@@ -522,6 +525,7 @@ else
end
end
close all
end
for j=1:size(SP,2),
nsx(j)=length(find(SP(:,j)));
......
......@@ -104,12 +104,15 @@ for j=1:size(anamendo,1)
for jx=1:size(anamexo,1)
namexo=deblank(anamexo(jx,:));
iexo=strmatch(namexo,M_.exo_names,'exact');
disp(' ')
disp(['[', namendo,' vs. ',namexo,']'])
if ~isempty(iexo),
%y0=squeeze(T(iendo,iexo+nspred,istable));
y0=squeeze(T(iendo,iexo+nspred,:));
if (max(y0)-min(y0))>1.e-10,
if mod(iplo,9)==0 && isempty(threshold),
if mod(iplo,9)==0 && isempty(threshold) && ~options_.nograph,
ifig=ifig+1;
hfig = dyn_figure(options_,'name',[namendo,' vs. shocks ',int2str(ifig)]);
iplo=0;
......@@ -140,6 +143,10 @@ for j=1:size(anamendo,1)
[proba, dproba] = stab_map_1(x0, iy, iyc, 'cut',0);
% indsmirnov = find(dproba>ksstat);
indsmirnov = find(proba<pvalue_ks);
for jp=1:length(indsmirnov),
disp([M_.param_names(estim_params_.param_vals(indsmirnov(jp),1),:),' d-stat = ', num2str(dproba(indsmirnov(jp)),'%1.3f'),' p-value = ', num2str(proba(indsmirnov(jp)),'%1.3f')])
end
disp(' ');
stab_map_1(x0, iy, iyc, 'cut',1,indsmirnov,xdir);
stab_map_2(x0(iy,:),alpha2,pvalue_corr,'cut',xdir)
stab_map_2(x0(iyc,:),alpha2,pvalue_corr,'trim',xdir)
......@@ -158,7 +165,7 @@ for j=1:size(anamendo,1)
silog(:,js) = redform_private(x0, yy, pshape, pd, iload, pnames, namendo, namexo, xdir, options_gsa_);
end
if isempty(threshold)
if isempty(threshold) && ~options_.nograph,
figure(hfig)
subplot(3,3,iplo),
if ilog,
......@@ -188,7 +195,7 @@ for j=1:size(anamendo,1)
end
end
end
if iplo<9 && iplo>0 && ifig,
if iplo<9 && iplo>0 && ifig && ~options_.nograph,
dyn_saveas(hfig,[dirname,'/',M_.fname,'_redform_', namendo,'_vs_shocks_',logflag,num2str(ifig)],options_);
if ~options_.nodisplay
close(hfig);
......@@ -199,12 +206,14 @@ for j=1:size(anamendo,1)
for je=1:size(anamlagendo,1)
namlagendo=deblank(anamlagendo(je,:));
ilagendo=strmatch(namlagendo,M_.endo_names(oo_.dr.order_var(oo_.dr.nstatic+1:oo_.dr.nstatic+nsok),:),'exact');
disp(' ')
disp(['[', namendo,' vs. lagged ',namlagendo,']'])
if ~isempty(ilagendo),
%y0=squeeze(T(iendo,ilagendo,istable));
y0=squeeze(T(iendo,ilagendo,:));
if (max(y0)-min(y0))>1.e-10,
if mod(iplo,9)==0 && isempty(threshold),
if mod(iplo,9)==0 && isempty(threshold) && ~options_.nograph,
ifig=ifig+1;
hfig = dyn_figure(options_,'name',[namendo,' vs. lags ',int2str(ifig)]);
iplo=0;
......@@ -233,6 +242,10 @@ for j=1:size(anamendo,1)
[proba, dproba] = stab_map_1(x0, iy, iyc, 'cut',0);
% indsmirnov = find(dproba>ksstat);
indsmirnov = find(proba<pvalue_ks);
for jp=1:length(indsmirnov),
disp([M_.param_names(estim_params_.param_vals(indsmirnov(jp),1),:),' d-stat = ', num2str(dproba(indsmirnov(jp)),'%1.3f'),' p-value = ', num2str(proba(indsmirnov(jp)),'%1.3f')])
end
disp(' ');
stab_map_1(x0, iy, iyc, 'cut',1,indsmirnov,xdir);
stab_map_2(x0(iy,:),alpha2,pvalue_corr,'cut',xdir)
stab_map_2(x0(iyc,:),alpha2,pvalue_corr,'trim',xdir)
......@@ -252,7 +265,7 @@ for j=1:size(anamendo,1)
silog(:,js) = redform_private(x0, yy, pshape, pd, iload, pnames, namendo, namlagendo, xdir, options_gsa_);
end
if isempty(threshold)
if isempty(threshold) && ~options_.nograph
figure(hfig),
subplot(3,3,iplo),
if ilog,
......@@ -282,7 +295,7 @@ for j=1:size(anamendo,1)
end
end
end
if iplo<9 && iplo>0 && ifig,
if iplo<9 && iplo>0 && ifig && ~options_.nograph,
dyn_saveas(hfig,[dirname,'/',M_.fname,'_redform_', namendo,'_vs_lags_',logflag,num2str(ifig)],options_);
if ~options_.nodisplay
close(hfig);
......@@ -290,7 +303,7 @@ for j=1:size(anamendo,1)
end
end
if isempty(threshold),
if isempty(threshold) && ~options_.nograph,
if ilog==0,
hfig=dyn_figure(options_); %bar(si)
% boxplot(si','whis',10,'symbol','r.')
......@@ -340,14 +353,16 @@ x00=x0;
fname=[xdir,'/map'];
if iload==0,
hfig=dyn_figure(options_); hist(y0,30), title([namy,' vs. ', namx])
if isempty(dir(xdir))
mkdir(xdir)
end
if ~options_.nograph,
hfig=dyn_figure(options_); hist(y0,30), title([namy,' vs. ', namx])
dyn_saveas(hfig,[xdir,'/', namy,'_vs_', namx],options_);
if ~options_.nodisplay
close(hfig);
end
end
% gsa_ = gsa_sdp_dyn(y0, x0, -2, [],[],[],1,fname, pnames);
nrun=length(y0);
nest=min(250,nrun);
......@@ -360,10 +375,13 @@ if iload==0,
save([fname,'.mat'],'gsa_')
[sidum, iii]=sort(-gsa_.si);
gsa_.x0=x00(1:nfit,:);
if ~options_.nograph,
hfig=gsa_sdp_plot(gsa_,fname,pnames,iii(1:min(12,np)));
close(hfig);
end
gsa_.x0=x0(1:nfit,:);
% copyfile([fname,'_est.mat'],[fname,'.mat'])
if ~options_.nograph,
hfig=dyn_figure(options_);
plot(y0(1:nfit),[gsa_.fit y0(1:nfit)],'.'),
title([namy,' vs. ', namx,' fit'])
......@@ -382,9 +400,12 @@ if iload==0,
close(hfig);
end
end
end
else
% gsa_ = gsa_sdp_dyn(y0, x0, 0, [],[],[],0,fname, pnames);
gsa_ = gsa_sdp(y0, x0, 0, [],[],[],0,fname, pnames);
if ~options_.nograph,
yf = ss_anova_fcast(x0, gsa_);
hfig=dyn_figure(options_);
plot(y0,[yf y0],'.'),
......@@ -394,6 +415,7 @@ else
close(hfig);
end
end
end
% si = gsa_.multivariate.si;
si = gsa_.si;
......@@ -77,7 +77,7 @@ if isempty(ipar),
ipar=find(proba<pcrit);
end
nparplot=length(ipar);
if iplot
if iplot && ~options_.nograph
lpmat=lpmat(:,ipar);
ftit=bayestopt_.name(ipar+nshock*(1-ishock));
......
......@@ -64,6 +64,9 @@ if ishock==0
else
npar=estim_params_.np+nshock;
end
disp([' '])
disp(['Correlation analysis for ',fnam])
for j=1:npar,
i2=find(abs(c00(:,j))>alpha2);
if length(i2)>0,
......@@ -72,6 +75,15 @@ for j=1:npar,
tcr = tcrit(nsam-2,pvalue);
if tval>tcr,
j2=j2+1;
if ishock,
tmp_name = (['[',bayestopt_.name{j},',',bayestopt_.name{i2(jx)},']']);
else
tmp_name = (['[',bayestopt_.name{j+nshock},',',bayestopt_.name{i2(jx)+nshock},']']);
end
fprintf(1,'%20s: corrcoef = %7.3f\n',tmp_name,c0(i2(jx),j));
if ~options_.nograph,
if mod(j2,12)==1,
ifig=ifig+1;
hh=dyn_figure(options_,'name',['Correlations in the ',fnam,' sample ', num2str(ifig)]);
......@@ -103,10 +115,11 @@ for j=1:npar,
end
end
end
end
end
end
if (j==(npar)) && j2>0,
if ~options_.nograph && (j==(npar)) && j2>0,
dyn_saveas(hh,[dirname,'/',fig_nam_,int2str(ifig)],options_);
if ~options_.nodisplay
close(hh);
......@@ -114,7 +127,7 @@ for j=1:npar,
end
end
if ifig==0,
if j2==0,
disp(['No correlation term with pvalue <', num2str(pvalue),' found for ',fnam])
end
%close all
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment