parent
0b1188c923
commit
80582b19bd
|
@ -109,6 +109,8 @@ options_gsa = set_default_option(options_gsa,'load_rmse',0);
|
||||||
options_gsa = set_default_option(options_gsa,'load_stab',0);
|
options_gsa = set_default_option(options_gsa,'load_stab',0);
|
||||||
options_gsa = set_default_option(options_gsa,'alpha2_stab',0.3);
|
options_gsa = set_default_option(options_gsa,'alpha2_stab',0.3);
|
||||||
options_gsa = set_default_option(options_gsa,'ksstat',0.1);
|
options_gsa = set_default_option(options_gsa,'ksstat',0.1);
|
||||||
|
options_gsa = set_default_option(options_gsa,'pvalue_ks',0.001);
|
||||||
|
options_gsa = set_default_option(options_gsa,'pvalue_corr',0.001);
|
||||||
%options_gsa = set_default_option(options_gsa,'load_mh',0);
|
%options_gsa = set_default_option(options_gsa,'load_mh',0);
|
||||||
|
|
||||||
if options_gsa.redform,
|
if options_gsa.redform,
|
||||||
|
|
|
@ -56,6 +56,8 @@ Nsam = opt_gsa.Nsam;
|
||||||
fload = opt_gsa.load_stab;
|
fload = opt_gsa.load_stab;
|
||||||
ksstat = opt_gsa.ksstat;
|
ksstat = opt_gsa.ksstat;
|
||||||
alpha2 = opt_gsa.alpha2_stab;
|
alpha2 = opt_gsa.alpha2_stab;
|
||||||
|
pvalue_ks = opt_gsa.pvalue_ks;
|
||||||
|
pvalue_corr = opt_gsa.pvalue_corr;
|
||||||
prepSA = (opt_gsa.redform | opt_gsa.identification);
|
prepSA = (opt_gsa.redform | opt_gsa.identification);
|
||||||
pprior = opt_gsa.pprior;
|
pprior = opt_gsa.pprior;
|
||||||
neighborhood_width = opt_gsa.neighborhood_width;
|
neighborhood_width = opt_gsa.neighborhood_width;
|
||||||
|
@ -252,7 +254,7 @@ if fload==0,
|
||||||
egg=zeros(length(dr_.eigval),Nsam);
|
egg=zeros(length(dr_.eigval),Nsam);
|
||||||
end
|
end
|
||||||
if infox{j},
|
if infox{j},
|
||||||
disp('no solution'),
|
% disp('no solution'),
|
||||||
if isfield(oo_.dr,'ghx'),
|
if isfield(oo_.dr,'ghx'),
|
||||||
oo_.dr=rmfield(oo_.dr,'ghx');
|
oo_.dr=rmfield(oo_.dr,'ghx');
|
||||||
end
|
end
|
||||||
|
@ -448,22 +450,23 @@ delete([OutputDirectoryName,'/',fname_,'_',aunstname,'_corr_*.*']);
|
||||||
delete([OutputDirectoryName,'/',fname_,'_',aindname,'_corr_*.*']);
|
delete([OutputDirectoryName,'/',fname_,'_',aindname,'_corr_*.*']);
|
||||||
|
|
||||||
if length(iunstable)>0 & length(iunstable)<Nsam,
|
if length(iunstable)>0 & length(iunstable)<Nsam,
|
||||||
disp([num2str(length(istable)/Nsam*100,3),'\% of the prior support is stable.'])
|
fprintf(['%4.1f%% of the prior support is stable.\n'],length(istable)/Nsam*100)
|
||||||
disp([num2str( (length(iunstable)-length(iwrong)-length(iindeterm) )/Nsam*100),'\% of the prior support is unstable.'])
|
fprintf(['%4.1f%% of the prior support is unstable.\n'],(length(iunstable)-length(iwrong)-length(iindeterm) )/Nsam*100)
|
||||||
if ~isempty(iindeterm),
|
if ~isempty(iindeterm),
|
||||||
disp([num2str(length(iindeterm)/Nsam*100,3),'\% of the prior support gives indeterminacy.'])
|
fprintf(['%4.1f%% of the prior support gives indeterminacy.'],length(iindeterm)/Nsam*100)
|
||||||
end
|
end
|
||||||
if ~isempty(iwrong),
|
if ~isempty(iwrong),
|
||||||
disp(' ');
|
disp(' ');
|
||||||
disp(['For ',num2str(length(iwrong)/Nsam*100,3),'\% of the prior support dynare could not find a solution.'])
|
disp(['For ',num2str(length(iwrong)/Nsam*100,'%1.3f'),'\% of the prior support dynare could not find a solution.'])
|
||||||
end
|
end
|
||||||
disp(' ');
|
disp(' ');
|
||||||
% Blanchard Kahn
|
% Blanchard Kahn
|
||||||
[proba, dproba] = stab_map_1(lpmat, istable, iunstable, aname,0);
|
[proba, dproba] = stab_map_1(lpmat, istable, iunstable, aname,0);
|
||||||
indstab=find(dproba>ksstat);
|
% indstab=find(dproba>ksstat);
|
||||||
|
indstab=find(proba<pvalue_ks);
|
||||||
disp('Smirnov statistics in driving acceptable behaviour')
|
disp('Smirnov statistics in driving acceptable behaviour')
|
||||||
for j=1:np,
|
for j=1:length(indstab),
|
||||||
disp([M_.param_names(estim_params_.param_vals(j,1),:),' d-stat = ', num2str(dproba(j),3)])
|
disp([M_.param_names(estim_params_.param_vals(indstab(j),1),:),' d-stat = ', num2str(dproba(indstab(j)),'%1.3f'),' p-value = ', num2str(proba(indstab(j)),'%1.3f')])
|
||||||
end
|
end
|
||||||
disp(' ');
|
disp(' ');
|
||||||
if ~isempty(indstab)
|
if ~isempty(indstab)
|
||||||
|
@ -472,10 +475,11 @@ if length(iunstable)>0 & length(iunstable)<Nsam,
|
||||||
ixun=iunstable(find(~ismember(iunstable,[iindeterm,iwrong])));
|
ixun=iunstable(find(~ismember(iunstable,[iindeterm,iwrong])));
|
||||||
if ~isempty(iindeterm),
|
if ~isempty(iindeterm),
|
||||||
[proba, dproba] = stab_map_1(lpmat, [1:Nsam], iindeterm, [aname, '_indet'],0);
|
[proba, dproba] = stab_map_1(lpmat, [1:Nsam], iindeterm, [aname, '_indet'],0);
|
||||||
indindet=find(dproba>ksstat);
|
% indindet=find(dproba>ksstat);
|
||||||
|
indindet=find(proba<pvalue_ks);
|
||||||
disp('Smirnov statistics in driving indeterminacy')
|
disp('Smirnov statistics in driving indeterminacy')
|
||||||
for j=1:np,
|
for j=1:length(indindet),
|
||||||
disp([M_.param_names(estim_params_.param_vals(j,1),:),' d-stat = ', num2str(dproba(j),3)])
|
disp([M_.param_names(estim_params_.param_vals(indindet(j),1),:),' d-stat = ', num2str(dproba(indindet(j)),'%1.3f'),' p-value = ', num2str(proba(indindet(j)),'%1.3f')])
|
||||||
end
|
end
|
||||||
disp(' ');
|
disp(' ');
|
||||||
if ~isempty(indindet)
|
if ~isempty(indindet)
|
||||||
|
@ -485,10 +489,11 @@ if length(iunstable)>0 & length(iunstable)<Nsam,
|
||||||
|
|
||||||
if ~isempty(ixun),
|
if ~isempty(ixun),
|
||||||
[proba, dproba] = stab_map_1(lpmat, [1:Nsam], ixun, [aname, '_unst'],0);
|
[proba, dproba] = stab_map_1(lpmat, [1:Nsam], ixun, [aname, '_unst'],0);
|
||||||
indunst=find(dproba>ksstat);
|
% indunst=find(dproba>ksstat);
|
||||||
|
indunst=find(proba<pvalue_ks);
|
||||||
disp('Smirnov statistics in driving instability')
|
disp('Smirnov statistics in driving instability')
|
||||||
for j=1:np,
|
for j=1:length(indunst),
|
||||||
disp([M_.param_names(estim_params_.param_vals(j,1),:),' d-stat = ', num2str(dproba(j),3)])
|
disp([M_.param_names(estim_params_.param_vals(indunst(j),1),:),' d-stat = ', num2str(dproba(indunst(j)),'%1.3f'),' p-value = ', num2str(proba(indunst(j)),'%1.3f')])
|
||||||
end
|
end
|
||||||
disp(' ');
|
disp(' ');
|
||||||
if ~isempty(indunst)
|
if ~isempty(indunst)
|
||||||
|
@ -498,10 +503,11 @@ if length(iunstable)>0 & length(iunstable)<Nsam,
|
||||||
|
|
||||||
if ~isempty(iwrong),
|
if ~isempty(iwrong),
|
||||||
[proba, dproba] = stab_map_1(lpmat, [1:Nsam], iwrong, [aname, '_wrong'],0);
|
[proba, dproba] = stab_map_1(lpmat, [1:Nsam], iwrong, [aname, '_wrong'],0);
|
||||||
indwrong=find(dproba>ksstat);
|
% indwrong=find(dproba>ksstat);
|
||||||
|
indwrong=find(proba<pvalue_ks);
|
||||||
disp('Smirnov statistics in driving no solution')
|
disp('Smirnov statistics in driving no solution')
|
||||||
for j=1:np,
|
for j=1:length(indwrong),
|
||||||
disp([M_.param_names(estim_params_.param_vals(j,1),:),' d-stat = ', num2str(dproba(j),3)])
|
disp([M_.param_names(estim_params_.param_vals(indwrong(j),1),:),' d-stat = ', num2str(dproba(indwrong(j)),'%1.3f'),' p-value = ', num2str(proba(indwrong(j)),'%1.3f')])
|
||||||
end
|
end
|
||||||
disp(' ');
|
disp(' ');
|
||||||
if ~isempty(indwrong)
|
if ~isempty(indwrong)
|
||||||
|
@ -515,18 +521,18 @@ if length(iunstable)>0 & length(iunstable)<Nsam,
|
||||||
c0=corrcoef(lpmat(istable,:));
|
c0=corrcoef(lpmat(istable,:));
|
||||||
c00=tril(c0,-1);
|
c00=tril(c0,-1);
|
||||||
|
|
||||||
stab_map_2(lpmat(istable,:),alpha2, asname, OutputDirectoryName);
|
stab_map_2(lpmat(istable,:),alpha2, pvalue_corr, asname, OutputDirectoryName);
|
||||||
if length(iunstable)>10,
|
if length(iunstable)>10,
|
||||||
stab_map_2(lpmat(iunstable,:),alpha2, auname, OutputDirectoryName);
|
stab_map_2(lpmat(iunstable,:),alpha2, pvalue_corr, auname, OutputDirectoryName);
|
||||||
end
|
end
|
||||||
if length(iindeterm)>10,
|
if length(iindeterm)>10,
|
||||||
stab_map_2(lpmat(iindeterm,:),alpha2, aindname, OutputDirectoryName);
|
stab_map_2(lpmat(iindeterm,:),alpha2, pvalue_corr, aindname, OutputDirectoryName);
|
||||||
end
|
end
|
||||||
if length(ixun)>10,
|
if length(ixun)>10,
|
||||||
stab_map_2(lpmat(ixun,:),alpha2, aunstname, OutputDirectoryName);
|
stab_map_2(lpmat(ixun,:),alpha2, pvalue_corr, aunstname, OutputDirectoryName);
|
||||||
end
|
end
|
||||||
if length(iwrong)>10,
|
if length(iwrong)>10,
|
||||||
stab_map_2(lpmat(iwrong,:),alpha2, awrongname, OutputDirectoryName);
|
stab_map_2(lpmat(iwrong,:),alpha2, pvalue_corr, awrongname, OutputDirectoryName);
|
||||||
end
|
end
|
||||||
|
|
||||||
x0=0.5.*(bayestopt_.ub(1:nshock)-bayestopt_.lb(1:nshock))+bayestopt_.lb(1:nshock);
|
x0=0.5.*(bayestopt_.ub(1:nshock)-bayestopt_.lb(1:nshock))+bayestopt_.lb(1:nshock);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function [proba, dproba] = stab_map_1(lpmat, ibehaviour, inonbehaviour, aname, iplot, ipar, dirname, dcrit)
|
function [proba, dproba] = stab_map_1(lpmat, ibehaviour, inonbehaviour, aname, iplot, ipar, dirname, pcrit)
|
||||||
%function [proba, dproba] = stab_map_1(lpmat, ibehaviour, inonbehaviour, aname, iplot, ipar, dirname, dcrit)
|
%function [proba, dproba] = stab_map_1(lpmat, ibehaviour, inonbehaviour, aname, iplot, ipar, dirname, pcrit)
|
||||||
%
|
%
|
||||||
% lpmat = Monte Carlo matrix
|
% lpmat = Monte Carlo matrix
|
||||||
% ibehaviour = index of behavioural runs
|
% ibehaviour = index of behavioural runs
|
||||||
|
@ -10,7 +10,7 @@ function [proba, dproba] = stab_map_1(lpmat, ibehaviour, inonbehaviour, aname, i
|
||||||
% ipar = index array of parameters to plot
|
% ipar = index array of parameters to plot
|
||||||
% dirname = (OPTIONAL) path of the directory where to save
|
% dirname = (OPTIONAL) path of the directory where to save
|
||||||
% (default: current directory)
|
% (default: current directory)
|
||||||
% dcrit = (OPTIONAL) critical value of the D-stat above which show the plots
|
% pcrit = (OPTIONAL) critical value of the pvalue below which show the plots
|
||||||
%
|
%
|
||||||
% Plots: dotted lines for BEHAVIOURAL
|
% Plots: dotted lines for BEHAVIOURAL
|
||||||
% solid lines for NON BEHAVIOURAL
|
% solid lines for NON BEHAVIOURAL
|
||||||
|
@ -54,7 +54,7 @@ if nargin<6,
|
||||||
ipar=[];
|
ipar=[];
|
||||||
end
|
end
|
||||||
if nargin<8 || isempty(dcrit),
|
if nargin<8 || isempty(dcrit),
|
||||||
dcrit=0;
|
pcrit=1;
|
||||||
end
|
end
|
||||||
|
|
||||||
% Smirnov test for Blanchard;
|
% Smirnov test for Blanchard;
|
||||||
|
@ -64,7 +64,8 @@ for j=1:npar,
|
||||||
dproba(j)=KSSTAT;
|
dproba(j)=KSSTAT;
|
||||||
end
|
end
|
||||||
if isempty(ipar),
|
if isempty(ipar),
|
||||||
ipar=find(dproba>dcrit);
|
% ipar=find(dproba>dcrit);
|
||||||
|
ipar=find(proba<pcrit);
|
||||||
end
|
end
|
||||||
nparplot=length(ipar);
|
nparplot=length(ipar);
|
||||||
if iplot
|
if iplot
|
||||||
|
@ -84,7 +85,8 @@ for i=1:ceil(nparplot/12),
|
||||||
h=cumplot(lpmat(inonbehaviour,j));
|
h=cumplot(lpmat(inonbehaviour,j));
|
||||||
set(h,'color',[0 0 0])
|
set(h,'color',[0 0 0])
|
||||||
end
|
end
|
||||||
title([ftit{j},'. D-stat ', num2str(dproba(ipar(j)),2)],'interpreter','none')
|
% title([ftit{j},'. D-stat ', num2str(dproba(ipar(j)),2)],'interpreter','none')
|
||||||
|
title([ftit{j},'. p-value ', num2str(proba(ipar(j)),2)],'interpreter','none')
|
||||||
end
|
end
|
||||||
saveas(gcf,[dirname,'/',fname_,'_',aname,'_SA_',int2str(i)])
|
saveas(gcf,[dirname,'/',fname_,'_',aname,'_SA_',int2str(i)])
|
||||||
eval(['print -depsc2 ' dirname '/' fname_ '_' aname '_SA_' int2str(i)]);
|
eval(['print -depsc2 ' dirname '/' fname_ '_' aname '_SA_' int2str(i)]);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
%function stab_map_2(x,alpha2,istab,fnam)
|
function stab_map_2(x,alpha2, pvalue, fnam, dirname)
|
||||||
function stab_map_2(x,alpha2,fnam, dirname)
|
% function stab_map_2(x, alpha2, pvalue, fnam, dirname)
|
||||||
% function stab_map_2(x,alpha2,fnam, dirname)
|
|
||||||
%
|
%
|
||||||
% Part of the Sensitivity Analysis Toolbox for DYNARE
|
% Part of the Sensitivity Analysis Toolbox for DYNARE
|
||||||
%
|
%
|
||||||
|
@ -22,11 +21,12 @@ function stab_map_2(x,alpha2,fnam, dirname)
|
||||||
global bayestopt_ estim_params_ options_ oo_ M_
|
global bayestopt_ estim_params_ options_ oo_ M_
|
||||||
|
|
||||||
npar=size(x,2);
|
npar=size(x,2);
|
||||||
|
nsam=size(x,1);
|
||||||
ishock= npar>estim_params_.np;
|
ishock= npar>estim_params_.np;
|
||||||
if nargin<3,
|
if nargin<4,
|
||||||
fnam='';
|
fnam='';
|
||||||
end
|
end
|
||||||
if nargin<4,
|
if nargin<5,
|
||||||
dirname='';
|
dirname='';
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -53,6 +53,9 @@ for j=1:npar,
|
||||||
i2=find(abs(c00(:,j))>alpha2);
|
i2=find(abs(c00(:,j))>alpha2);
|
||||||
if length(i2)>0,
|
if length(i2)>0,
|
||||||
for jx=1:length(i2),
|
for jx=1:length(i2),
|
||||||
|
tval = abs(c00(i2(jx),j)*sqrt( (nsam-2)/(1-c00(i2(jx),j)^2) ));
|
||||||
|
tcr = tcrit(nsam-2,pvalue);
|
||||||
|
if tval>tcr,
|
||||||
j2=j2+1;
|
j2=j2+1;
|
||||||
if mod(j2,12)==1,
|
if mod(j2,12)==1,
|
||||||
ifig=ifig+1;
|
ifig=ifig+1;
|
||||||
|
@ -81,6 +84,7 @@ for j=1:npar,
|
||||||
eval(['print -dpdf ' dirname '/' fig_nam_ int2str(ifig)]);
|
eval(['print -dpdf ' dirname '/' fig_nam_ int2str(ifig)]);
|
||||||
if options_.nograph, close(gcf), end
|
if options_.nograph, close(gcf), end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if (j==(npar)) & j2>0,
|
if (j==(npar)) & j2>0,
|
||||||
|
|
Loading…
Reference in New Issue