2023-11-29 13:46:56 +01:00
function map_ident_ ( OutputDirectoryName,opt_gsa,M_,oo_,options_,estim_params_,bayestopt_)
% map_ident_(OutputDirectoryName,opt_gsa,M_,oo_,options_,estim_params_,bayestopt_)
2023-11-25 19:19:46 +01:00
% Inputs
% - OutputDirectoryName [string] name of the output directory
% - opt_gsa [structure] GSA options structure
% - M_ [structure] Matlab's structure describing the model
2023-11-29 13:46:56 +01:00
% - oo_ [structure] Matlab's structure describing the results
2023-11-25 19:19:46 +01:00
% - options_ [structure] Matlab's structure describing the current options
2023-11-29 13:46:56 +01:00
% - estim_params_ [structure] characterizing parameters to be estimated
2023-11-25 19:19:46 +01:00
% - bayestopt_ [structure] describing the priors
2012-01-09 13:12:31 +01:00
2017-02-03 12:48:27 +01:00
% Written by Marco Ratto
% Joint Research Centre, The European Commission,
2017-05-16 15:10:20 +02:00
% marco.ratto@ec.europa.eu
2017-02-03 12:48:27 +01:00
2022-04-13 13:15:19 +02:00
% Copyright © 2012-2016 European Commission
2023-09-19 13:19:07 +02:00
% Copyright © 2012-2023 Dynare Team
2012-01-09 13:12:31 +01:00
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
2023-11-25 19:19:46 +01:00
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
2012-01-09 13:12:31 +01:00
2011-12-09 21:13:16 +01:00
fname_ = M_ . fname ;
2023-11-29 13:46:56 +01:00
dr = oo_ . dr ;
2011-12-09 21:13:16 +01:00
nliv = opt_gsa . morris_nliv ;
itrans = opt_gsa . trans_ident ;
2023-11-29 13:46:56 +01:00
np = size ( estim_params_ . param_vals , 1 ) ;
2011-12-09 21:13:16 +01:00
2023-11-29 13:46:56 +01:00
pnames = M_ . param_names ( estim_params_ . param_vals ( : , 1 ) ) ;
2017-05-16 15:10:20 +02:00
if opt_gsa . pprior
filetoload = [ OutputDirectoryName ' /' fname_ ' _prior' ] ;
else
filetoload = [ OutputDirectoryName ' /' fname_ ' _mc' ] ;
end
2023-11-25 19:19:46 +01:00
load ( filetoload , ' lpmat' , ' lpmat0' , ' istable' , ' T' , ' yys' )
2017-05-16 12:42:01 +02:00
if ~ isempty ( lpmat0 )
2017-05-16 15:10:20 +02:00
lpmatx = lpmat0 ( istable , : ) ;
2011-12-09 21:13:16 +01:00
else
2017-05-16 15:10:20 +02:00
lpmatx = [ ] ;
2011-12-09 21:13:16 +01:00
end
Nsam = size ( lpmat , 1 ) ;
nshock = size ( lpmat0 , 2 ) ;
npT = np + nshock ;
fname_ = M_ . fname ;
2017-05-16 12:42:01 +02:00
if opt_gsa . load_ident_files == 0
2017-05-16 15:10:20 +02:00
mss = yys ( bayestopt_ . mfys , : ) ;
mss = teff ( mss ( : , istable ) , Nsam , istable ) ;
2023-11-25 19:19:46 +01:00
yys = teff ( yys ( dr . order_var , istable ) , Nsam , istable ) ;
if exist ( ' T' , ' var' )
2023-11-29 13:46:56 +01:00
[ vdec , cc , ac ] = mc_moments ( T , lpmatx , dr , M_ , options_ , estim_params_ ) ;
2017-05-16 15:10:20 +02:00
else
return
2011-12-09 21:13:16 +01:00
end
2017-05-16 15:10:20 +02:00
if opt_gsa . morris == 2
2023-11-29 13:46:56 +01:00
pdraws = dynare_identification ( M_ , oo_ , options_ , bayestopt_ , estim_params_ , options_ . options_ident , [ lpmatx lpmat ( istable , : ) ] ) ;
2017-05-16 15:10:20 +02:00
if ~ isempty ( pdraws ) && max ( max ( abs ( pdraws - [ lpmatx lpmat ( istable , : ) ] ) ) ) == 0
2023-11-29 13:46:56 +01:00
disp ( [ ' Sample check OK. Largest difference: ' , num2str ( max ( max ( abs ( pdraws - [ lpmatx lpmat ( istable , : ) ] ) ) ) ) ] ) ,
2017-05-16 15:10:20 +02:00
clear pdraws ;
end
clear GAM gas
end
2023-11-25 19:19:46 +01:00
if opt_gsa . morris ~= 1 && M_ . exo_nbr > 1
2017-05-16 15:10:20 +02:00
ifig = 0 ;
for j = 1 : M_ . exo_nbr
if mod ( j , 6 ) == 1
2023-11-28 15:12:24 +01:00
hh_fig = dyn_figure ( options_ . nodisplay , ' name' , ' Variance decomposition shocks' ) ;
2017-05-16 15:10:20 +02:00
ifig = ifig + 1 ;
iplo = 0 ;
end
iplo = iplo + 1 ;
subplot ( 2 , 3 , iplo )
myboxplot ( squeeze ( vdec ( : , j , : ) ) ' , [ ] , ' .' , [ ] , 10 )
2023-11-28 15:12:24 +01:00
set ( gca , ' xticklabel' , ' ' , ' fontsize' , 10 , ' xtick' , 1 : size ( options_ . varobs , 1 ) )
2017-05-16 15:10:20 +02:00
set ( gca , ' xlim' , [ 0.5 size ( options_ . varobs , 1 ) + 0.5 ] )
set ( gca , ' ylim' , [ - 2 102 ] )
for ip = 1 : size ( options_ . varobs , 1 )
2023-11-29 13:46:56 +01:00
if options_ . TeX
text ( ip , - 4 , deblank ( opt_gsa . varobs_tex ( ip , : ) ) , ' rotation' , 90 , ' HorizontalAlignment' , ' right' , ' interpreter' , ' latex' )
else
text ( ip , - 4 , deblank ( options_ . varobs ( ip , : ) ) , ' rotation' , 90 , ' HorizontalAlignment' , ' right' , ' interpreter' , ' none' )
end
2017-05-16 15:10:20 +02:00
end
xlabel ( ' ' )
ylabel ( ' ' )
2017-10-10 10:05:59 +02:00
title ( M_ . exo_names { j } , ' interpreter' , ' none' )
2023-11-25 19:19:46 +01:00
if mod ( j , 6 ) == 0 || j == M_ . exo_nbr
2023-09-19 13:19:07 +02:00
dyn_saveas ( hh_fig , [ OutputDirectoryName , ' /' , fname_ , ' _vdec_exo_' , int2str ( ifig ) ] , options_ . nodisplay , options_ . graph_format ) ;
2023-11-28 15:12:24 +01:00
create_TeX_loader ( options_ , [ OutputDirectoryName , ' /' , fname_ , ' _vdec_exo_' , int2str ( ifig ) ] , ifig , ' Variance decomposition shocks' , ' vdec_exo' , options_ . figures . textwidth * min ( iplo / 3 , 1 ) )
2017-05-16 15:10:20 +02:00
end
end
end
for j = 1 : size ( cc , 1 )
cc ( j , j , : ) = stand_ ( squeeze ( log ( cc ( j , j , : ) ) ) ) ./ 2 ;
2011-12-09 21:13:16 +01:00
end
2023-11-25 19:19:46 +01:00
[ vdec , ~ , ir_vdec , ic_vdec ] = teff ( vdec , Nsam , istable ) ;
[ cc , ~ , ir_cc , ic_cc ] = teff ( cc , Nsam , istable ) ;
[ ac , ~ , ir_ac , ic_ac ] = teff ( ac , Nsam , istable ) ;
2017-05-16 15:10:20 +02:00
2023-11-25 19:19:46 +01:00
nc1 = size ( T , 2 ) ;
2011-12-09 21:13:16 +01:00
endo_nbr = M_ . endo_nbr ;
2012-11-16 20:05:13 +01:00
nstatic = M_ . nstatic ;
nspred = M_ . nspred ;
2011-12-09 21:13:16 +01:00
iv = ( 1 : endo_nbr ) ' ;
2023-11-25 19:19:46 +01:00
ic = [ nstatic + ( 1 : nspred ) endo_nbr + ( 1 : size ( dr . ghx , 2 ) - nspred ) ] ' ;
2017-05-16 15:10:20 +02:00
2023-11-28 15:12:24 +01:00
dr . ghx = T ( : , 1 : ( nc1 - M_ . exo_nbr ) , 1 ) ;
dr . ghu = T ( : , ( nc1 - M_ . exo_nbr + 1 ) : end , 1 ) ;
2023-09-08 08:03:18 +02:00
[ Aa , Bb ] = kalman_transition_matrix ( dr , iv , ic ) ;
2017-05-16 15:10:20 +02:00
A = zeros ( size ( Aa , 1 ) , size ( Aa , 2 ) + size ( Aa , 1 ) , length ( istable ) ) ;
2017-05-16 12:42:01 +02:00
if ~ isempty ( lpmatx )
2023-11-29 13:46:56 +01:00
M_ = set_shocks_param ( M_ , estim_params_ , lpmatx ( 1 , : ) ) ;
2013-01-23 11:53:07 +01:00
end
2017-05-16 15:10:20 +02:00
A ( : , : , 1 ) = [ Aa , triu ( Bb * M_ . Sigma_e * Bb ' ) ] ;
for j = 2 : length ( istable )
2023-11-28 15:12:24 +01:00
dr . ghx = T ( : , 1 : ( nc1 - M_ . exo_nbr ) , j ) ;
dr . ghu = T ( : , ( nc1 - M_ . exo_nbr + 1 ) : end , j ) ;
2023-09-08 08:03:18 +02:00
[ Aa , Bb ] = kalman_transition_matrix ( dr , iv , ic ) ;
2017-05-16 15:10:20 +02:00
if ~ isempty ( lpmatx )
2023-11-29 13:46:56 +01:00
M_ = set_shocks_param ( M_ , estim_params_ , lpmatx ( j , : ) ) ;
2017-05-16 15:10:20 +02:00
end
A ( : , : , j ) = [ Aa , triu ( Bb * M_ . Sigma_e * Bb ' ) ] ;
end
clear T
clear lpmatx
[ yt , j0 ] = teff ( A , Nsam , istable ) ;
yt = [ yys yt ] ;
if opt_gsa . morris == 2
clear TAU A
else
clear A
end
save ( [ OutputDirectoryName , ' /' , fname_ , ' _main_eff.mat' ] , ' ac' , ' cc' , ' vdec' , ' yt' , ' mss' )
2023-11-25 19:19:46 +01:00
else %load identification files
2017-05-16 15:10:20 +02:00
load ( [ OutputDirectoryName , ' /' , fname_ , ' _main_eff.mat' ] , ' ac' , ' cc' , ' vdec' , ' yt' , ' mss' )
2011-12-09 21:13:16 +01:00
end
2017-05-16 12:42:01 +02:00
if opt_gsa . morris == 1
2017-05-16 15:10:20 +02:00
if ~ isempty ( vdec )
if opt_gsa . load_ident_files == 0
2023-11-25 19:19:46 +01:00
SAMorris = NaN ( npT , 3 , size ( vdec , 2 ) ) ;
2017-05-16 15:10:20 +02:00
for i = 1 : size ( vdec , 2 )
2023-11-25 19:19:46 +01:00
[ ~ , SAMorris ( : , : , i ) ] = Morris_Measure_Groups ( npT , [ lpmat0 lpmat ] , vdec ( : , i ) , nliv ) ;
2017-05-16 15:10:20 +02:00
end
SAvdec = squeeze ( SAMorris ( : , 1 , : ) ) ' ;
save ( [ OutputDirectoryName , ' /' , fname_ , ' _morris_IDE.mat' ] , ' SAvdec' , ' vdec' , ' ir_vdec' , ' ic_vdec' )
else
2023-11-28 15:12:24 +01:00
load ( [ OutputDirectoryName , ' /' , fname_ , ' _morris_IDE.mat' ] , ' SAvdec' )
2017-05-16 15:10:20 +02:00
end
2011-12-09 21:13:16 +01:00
2023-09-19 13:19:07 +02:00
hh_fig = dyn_figure ( options_ . nodisplay , ' name' , ' Screening identification: variance decomposition' ) ;
2017-05-16 15:10:20 +02:00
myboxplot ( SAvdec , [ ] , ' .' , [ ] , 10 )
2023-11-28 15:12:24 +01:00
set ( gca , ' xticklabel' , ' ' , ' fontsize' , 10 , ' xtick' , 1 : npT )
2017-05-16 15:10:20 +02:00
set ( gca , ' xlim' , [ 0.5 npT + 0.5 ] )
ydum = get ( gca , ' ylim' ) ;
set ( gca , ' ylim' , [ 0 ydum ( 2 ) ] )
set ( gca , ' position' , [ 0.13 0.2 0.775 0.7 ] )
for ip = 1 : npT
2023-11-29 13:46:56 +01:00
if options_ . TeX
2023-11-30 13:31:51 +01:00
[ ~ , param_name_tex_temp ] = get_the_name ( ip , options_ . TeX , M_ , estim_params_ , options_ . varobs ) ;
2023-11-29 13:46:56 +01:00
text ( ip , - 2 , param_name_tex_temp , ' rotation' , 90 , ' HorizontalAlignment' , ' right' , ' interpreter' , ' latex' )
else
text ( ip , - 2 , bayestopt_ . name { ip } , ' rotation' , 90 , ' HorizontalAlignment' , ' right' , ' interpreter' , ' none' )
end
2017-05-16 15:10:20 +02:00
end
xlabel ( ' ' )
title ( ' Elementary effects variance decomposition' )
2023-09-19 13:19:07 +02:00
dyn_saveas ( hh_fig , [ OutputDirectoryName , ' /' , fname_ , ' _morris_vdec' ] , options_ . nodisplay , options_ . graph_format ) ;
2017-05-16 15:10:20 +02:00
create_TeX_loader ( options_ , [ OutputDirectoryName , ' /' , fname_ , ' _morris_vdec' ] , 1 , ' Screening identification: variance decomposition' , ' morris_vdec' , 1 )
else
save ( [ OutputDirectoryName , ' /' , fname_ , ' _morris_IDE.mat' ] , ' vdec' )
end
2011-12-09 21:13:16 +01:00
2017-05-16 15:10:20 +02:00
if opt_gsa . load_ident_files == 0
ccac = [ mss cc ac ] ;
2023-11-25 19:19:46 +01:00
SAMorris = NaN ( npT , 3 , size ( ccac , 2 ) ) ;
2017-05-16 15:10:20 +02:00
for i = 1 : size ( ccac , 2 )
2023-11-25 19:19:46 +01:00
[ ~ , SAMorris ( : , : , i ) ] = Morris_Measure_Groups ( npT , [ lpmat0 lpmat ] , [ ccac ( : , i ) ] , nliv ) ;
2017-05-16 15:10:20 +02:00
end
SAcc = squeeze ( SAMorris ( : , 1 , : ) ) ' ;
2023-11-25 19:19:46 +01:00
SAcc = SAcc ./ ( max ( SAcc , [ ] , 2 ) * ones ( 1 , npT ) ) ;
2017-05-16 15:10:20 +02:00
save ( [ OutputDirectoryName , ' /' , fname_ , ' _morris_IDE.mat' ] , ' SAcc' , ' cc' , ' ir_cc' , ' ic_cc' , ' -append' )
save ( [ OutputDirectoryName , ' /' , fname_ , ' _morris_IDE.mat' ] , ' ac' , ' ir_ac' , ' ic_ac' , ' -append' )
else
load ( [ OutputDirectoryName , ' /' , fname_ , ' _morris_IDE' ] , ' SAcc' , ' cc' , ' ir_cc' , ' ic_cc' )
load ( [ OutputDirectoryName , ' /' , fname_ , ' _morris_IDE' ] , ' ac' , ' ir_ac' , ' ic_ac' )
end
2011-12-09 21:13:16 +01:00
2023-09-19 13:19:07 +02:00
hh_fig = dyn_figure ( options_ . nodisplay , ' name' , ' Screening identification: theoretical moments' ) ;
2017-05-16 15:10:20 +02:00
myboxplot ( SAcc , [ ] , ' .' , [ ] , 10 )
2023-11-28 15:12:24 +01:00
set ( gca , ' xticklabel' , ' ' , ' fontsize' , 10 , ' xtick' , 1 : npT )
2017-05-16 15:10:20 +02:00
set ( gca , ' xlim' , [ 0.5 npT + 0.5 ] )
set ( gca , ' ylim' , [ 0 1 ] )
set ( gca , ' position' , [ 0.13 0.2 0.775 0.7 ] )
for ip = 1 : npT
2023-11-29 13:46:56 +01:00
if options_ . TeX
2023-11-30 13:31:51 +01:00
[ ~ , param_name_tex_temp ] = get_the_name ( ip , options_ . TeX , M_ , estim_params_ , options_ . varobs ) ;
2023-11-29 13:46:56 +01:00
text ( ip , - 0.02 , param_name_tex_temp , ' rotation' , 90 , ' HorizontalAlignment' , ' right' , ' interpreter' , ' latex' )
else
text ( ip , - 0.02 , bayestopt_ . name { ip } , ' rotation' , 90 , ' HorizontalAlignment' , ' right' , ' interpreter' , ' none' )
end
2017-05-16 15:10:20 +02:00
end
xlabel ( ' ' )
title ( ' Elementary effects in the moments' )
2023-09-19 13:19:07 +02:00
dyn_saveas ( hh_fig , [ OutputDirectoryName , ' /' , fname_ , ' _morris_moments' ] , options_ . nodisplay , options_ . graph_format ) ;
2017-05-16 15:10:20 +02:00
create_TeX_loader ( options_ , [ OutputDirectoryName , ' /' , fname_ , ' _morris_moments' ] , 1 , ' Screening identification: theoretical moments' , ' morris_moments' , 1 )
2011-12-09 21:13:16 +01:00
2017-05-16 15:10:20 +02:00
if opt_gsa . load_ident_files == 0
2023-11-25 19:19:46 +01:00
SAMorris = NaN ( npT , 3 , j0 ) ;
2017-05-16 15:10:20 +02:00
for j = 1 : j0
2023-11-25 19:19:46 +01:00
[ ~ , SAMorris ( : , : , j ) ] = Morris_Measure_Groups ( npT , [ lpmat0 lpmat ] , yt ( : , j ) , nliv ) ;
2017-05-16 15:10:20 +02:00
end
SAM = squeeze ( SAMorris ( 1 : end , 1 , : ) ) ;
2023-11-25 19:19:46 +01:00
SAnorm = NaN ( npT , j0 ) ;
irex = NaN ( j0 ) ;
2017-05-16 15:10:20 +02:00
for j = 1 : j0
SAnorm ( : , j ) = SAM ( : , j ) ./ max ( SAM ( : , j ) ) ;
irex ( j ) = length ( find ( SAnorm ( : , j ) > 0.01 ) ) ;
end
SAMmu = squeeze ( SAMorris ( 1 : end , 2 , : ) ) ;
2023-11-25 19:19:46 +01:00
SAmunorm = NaN ( npT , j0 ) ;
2017-05-16 15:10:20 +02:00
for j = 1 : j0
SAmunorm ( : , j ) = SAMmu ( : , j ) ./ max ( SAM ( : , j ) ) ; % normalised w.r.t. mu*
end
SAMsig = squeeze ( SAMorris ( 1 : end , 3 , : ) ) ;
2023-11-25 19:19:46 +01:00
SAsignorm = NaN ( npT , j0 ) ;
2017-05-16 15:10:20 +02:00
for j = 1 : j0
SAsignorm ( : , j ) = SAMsig ( : , j ) ./ max ( SAMsig ( : , j ) ) ;
end
save ( [ OutputDirectoryName , ' /' , fname_ , ' _morris_IDE.mat' ] , ' SAnorm' , ' SAmunorm' , ' SAsignorm' , ' -append' )
else
2023-11-28 15:12:24 +01:00
load ( [ OutputDirectoryName , ' /' , fname_ , ' _morris_IDE' ] , ' SAnorm' )
2017-05-16 15:10:20 +02:00
end
2023-11-25 19:19:46 +01:00
hh_fig = dyn_figure ( options_ . nodisplay , ' name' , ' Screening identification: model' ) ;
2017-05-16 15:10:20 +02:00
myboxplot ( SAnorm ' , [ ] , ' .' , [ ] , 10 )
2023-11-28 15:12:24 +01:00
set ( gca , ' xticklabel' , ' ' , ' fontsize' , 10 , ' xtick' , 1 : npT )
2017-05-16 15:10:20 +02:00
set ( gca , ' xlim' , [ 0.5 npT + 0.5 ] )
set ( gca , ' ylim' , [ 0 1 ] )
set ( gca , ' position' , [ 0.13 0.2 0.775 0.7 ] )
xlabel ( ' ' )
for ip = 1 : npT
2023-11-29 13:46:56 +01:00
if options_ . TeX
2023-11-30 13:31:51 +01:00
[ ~ , param_name_tex_temp ] = get_the_name ( ip , options_ . TeX , M_ , estim_params_ , options_ . varobs ) ;
2023-11-29 13:46:56 +01:00
text ( ip , - 0.02 , param_name_tex_temp , ' rotation' , 90 , ' HorizontalAlignment' , ' right' , ' interpreter' , ' latex' )
else
text ( ip , - 0.02 , bayestopt_ . name { ip } , ' rotation' , 90 , ' HorizontalAlignment' , ' right' , ' interpreter' , ' none' )
end
2017-05-16 15:10:20 +02:00
end
xlabel ( ' ' )
title ( ' Elementary effects in the model' )
2023-09-19 13:19:07 +02:00
dyn_saveas ( hh_fig , [ OutputDirectoryName , ' /' , fname_ , ' _morris_par' ] , options_ . nodisplay , options_ . graph_format ) ;
2017-05-16 15:10:20 +02:00
create_TeX_loader ( options_ , [ OutputDirectoryName , ' /' , fname_ , ' _morris_par' ] , 1 , ' Screening identification: model' , ' morris_par' , 1 )
2017-05-16 12:42:01 +02:00
elseif opt_gsa . morris == 3
2012-06-08 15:27:41 +02:00
return
2023-11-25 19:19:46 +01:00
elseif opt_gsa . morris == 2 % ISKREV stuff
2017-05-16 15:10:20 +02:00
return
2017-05-16 12:42:01 +02:00
else % main effects analysis
if itrans == 0
2017-05-16 15:10:20 +02:00
fsuffix = ' ' ;
2017-05-16 12:42:01 +02:00
elseif itrans == 1
2017-05-16 15:10:20 +02:00
fsuffix = ' _log' ;
2011-12-09 21:13:16 +01:00
else
2017-05-16 15:10:20 +02:00
fsuffix = ' _rank' ;
2011-12-09 21:13:16 +01:00
end
2017-05-16 15:10:20 +02:00
2023-11-28 15:12:24 +01:00
imap = 1 : npT ;
2017-05-16 15:10:20 +02:00
if isempty ( lpmat0 )
x0 = lpmat ( istable , : ) ;
else
x0 = [ lpmat0 ( istable , : ) , lpmat ( istable , : ) ] ;
2011-12-09 21:13:16 +01:00
end
2017-05-16 15:10:20 +02:00
nrun = length ( istable ) ;
nest = min ( 250 , nrun ) ;
if opt_gsa . load_ident_files == 0
try
EET = load ( [ OutputDirectoryName , ' /SCREEN/' , fname_ , ' _morris_IDE' ] , ' SAcc' , ' ir_cc' , ' ic_cc' ) ;
catch
EET = [ ] ;
end
ccac = stand_ ( [ mss cc ac ] ) ;
[ pcc , dd ] = eig ( cov ( ccac ( istable , : ) ) ) ;
[ latent , isort ] = sort ( - diag ( dd ) ) ;
latent = - latent ;
figure , bar ( latent )
title ( ' Eigenvalues in PCA' )
pcc = pcc ( : , isort ) ;
ccac = ccac * pcc ;
npca = max ( find ( cumsum ( latent ) ./ length ( latent ) < 0.99 ) ) + 1 ;
siPCA = ( EET . SAcc ' * abs ( pcc ' ) ) ' ;
2023-11-25 19:19:46 +01:00
siPCA = siPCA ./ ( max ( siPCA , [ ] , 2 ) * ones ( 1 , npT ) ) ;
2017-05-16 15:10:20 +02:00
SAcc = zeros ( size ( ccac , 2 ) , npT ) ;
2023-11-25 19:19:46 +01:00
gsa_ = NaN ( npca ) ;
2017-05-16 15:10:20 +02:00
for j = 1 : npca %size(ccac,2),
if itrans == 0
y0 = ccac ( istable , j ) ;
elseif itrans == 1
y0 = log_trans_ ( ccac ( istable , j ) ) ;
else
y0 = trank ( ccac ( istable , j ) ) ;
end
if ~ isempty ( EET )
imap = find ( siPCA ( j , : ) > = ( 0.1 .* max ( siPCA ( j , : ) ) ) ) ;
end
gsa_ ( j ) = gsa_sdp ( y0 ( 1 : nest ) , x0 ( 1 : nest , imap ) , ...
2 , [ ] , [ ] , [ ] , 0 , [ OutputDirectoryName , ' /map_cc' , fsuffix , int2str ( j ) ] , pnames ) ;
SAcc ( j , imap ) = gsa_ ( j ) . si ;
imap_cc { j } = imap ;
end
save ( [ OutputDirectoryName , ' /map_cc' , fsuffix , ' .mat' ] , ' gsa_' )
save ( [ OutputDirectoryName , ' /' , fname_ , ' _main_eff.mat' ] , ' imap_cc' , ' SAcc' , ' ccac' , ' -append' )
else
2023-11-28 15:12:24 +01:00
load ( [ OutputDirectoryName , ' /' , fname_ , ' _main_eff' ] , ' SAcc' )
2017-05-16 15:10:20 +02:00
end
2023-09-19 13:19:07 +02:00
hh_fig = dyn_figure ( options_ . nodisplay , ' Name' , [ ' Identifiability indices in the ' , fsuffix , ' moments.' ] ) ;
2017-05-16 15:10:20 +02:00
bar ( sum ( SAcc ) )
2023-11-28 15:12:24 +01:00
set ( gca , ' xticklabel' , ' ' , ' fontsize' , 10 , ' xtick' , 1 : npT )
2017-05-16 15:10:20 +02:00
set ( gca , ' xlim' , [ 0.5 npT + 0.5 ] )
ydum = get ( gca , ' ylim' ) ;
set ( gca , ' ylim' , [ 0 ydum ( 2 ) ] )
set ( gca , ' position' , [ 0.13 0.2 0.775 0.7 ] )
for ip = 1 : npT
text ( ip , - 0.02 * ( ydum ( 2 ) ) , bayestopt_ . name { ip } , ' rotation' , 90 , ' HorizontalAlignment' , ' right' , ' interpreter' , ' none' )
end
xlabel ( ' ' )
title ( [ ' Identifiability indices in the ' , fsuffix , ' moments.' ] , ' interpreter' , ' none' )
2023-09-19 13:19:07 +02:00
dyn_saveas ( hh_fig , [ OutputDirectoryName , ' /' , fname_ , ' _ident_ALL' , fsuffix ] , options_ . nodisplay , options_ . graph_format ) ;
2017-05-16 15:10:20 +02:00
create_TeX_loader ( options_ , [ OutputDirectoryName , ' /' , fname_ , ' _ident_ALL' , fsuffix ] , 1 , [ ' Identifiability indices in the ' , fsuffix , ' moments.' ] , [ ' ident_ALL' , fsuffix ] ' , 1 )
2011-12-09 21:13:16 +01:00
end
2016-06-19 12:38:31 +02:00
function []= create_TeX_loader ( options_,figpath,ifig_number,caption,label_name,scale_factor)
if nargin < 6
scale_factor = 1 ;
end
2015-12-14 14:09:37 +01:00
if options_ . TeX && any ( strcmp ( ' eps' , cellstr ( options_ . graph_format ) ) )
2016-06-14 09:48:35 +02:00
fidTeX = fopen ( [ figpath ' .tex' ] , ' w' ) ;
2015-12-14 14:09:37 +01:00
fprintf ( fidTeX , ' %% TeX eps-loader file generated by map_ident_.m (Dynare).\n' ) ;
fprintf ( fidTeX , [ ' %% ' datestr ( now , 0 ) ' \n\n' ] ) ;
fprintf ( fidTeX , ' \\begin{figure}[H]\n' ) ;
fprintf ( fidTeX , ' \\centering \n' ) ;
2016-06-19 12:38:31 +02:00
fprintf ( fidTeX , ' \\includegraphics[width=%2.2f\\textwidth]{%s}\n' , scale_factor , strrep ( figpath , ' \' , ' /' ) ) ;
2015-12-14 14:09:37 +01:00
fprintf ( fidTeX , ' \\caption{%s.}' , caption ) ;
fprintf ( fidTeX , ' \\label{Fig:%s:%u}\n' , label_name , ifig_number ) ;
fprintf ( fidTeX , ' \\end{figure}\n\n' ) ;
fprintf ( fidTeX , ' %% End Of TeX file. \n' ) ;
fclose ( fidTeX ) ;
end