Home > matlab > gsa > redform_screen.m

redform_screen

PURPOSE ^

function redform_map(dirname)

SYNOPSIS ^

function redform_screen(dirname)

DESCRIPTION ^

function redform_map(dirname)
 inputs (from opt_gsa structure
 anamendo    = options_gsa_.namendo;
 anamlagendo = options_gsa_.namlagendo;
 anamexo     = options_gsa_.namexo;
 iload       = options_gsa_.load_redform;

 Written by Marco Ratto
 Joint Research Centre, The European Commission,
 (http://eemc.jrc.ec.europa.eu/),
 marco.ratto@jrc.it

 Reference:
 M. Ratto, Global Sensitivity Analysis for Macroeconomic models, MIMEO, 2006.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function redform_screen(dirname)
0002 %function redform_map(dirname)
0003 % inputs (from opt_gsa structure
0004 % anamendo    = options_gsa_.namendo;
0005 % anamlagendo = options_gsa_.namlagendo;
0006 % anamexo     = options_gsa_.namexo;
0007 % iload       = options_gsa_.load_redform;
0008 %
0009 % Written by Marco Ratto
0010 % Joint Research Centre, The European Commission,
0011 % (http://eemc.jrc.ec.europa.eu/),
0012 % marco.ratto@jrc.it
0013 %
0014 % Reference:
0015 % M. Ratto, Global Sensitivity Analysis for Macroeconomic models, MIMEO, 2006.
0016 
0017 % Copyright (C) 2012 Dynare Team
0018 %
0019 % This file is part of Dynare.
0020 %
0021 % Dynare is free software: you can redistribute it and/or modify
0022 % it under the terms of the GNU General Public License as published by
0023 % the Free Software Foundation, either version 3 of the License, or
0024 % (at your option) any later version.
0025 %
0026 % Dynare is distributed in the hope that it will be useful,
0027 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0028 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0029 % GNU General Public License for more details.
0030 %
0031 % You should have received a copy of the GNU General Public License
0032 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0033 
0034 global M_ oo_ estim_params_ options_ bayestopt_
0035 
0036 options_gsa_ = options_.opt_gsa;
0037 
0038 anamendo = options_gsa_.namendo;
0039 anamlagendo = options_gsa_.namlagendo;
0040 anamexo = options_gsa_.namexo;
0041 iload = options_gsa_.load_redform;
0042 nliv = options_gsa_.morris_nliv;
0043 
0044 pnames = M_.param_names(estim_params_.param_vals(:,1),:);
0045 if nargin==0,
0046   dirname='';
0047 end
0048 
0049 load([dirname,'/',M_.fname,'_prior'],'lpmat','lpmat0','istable','T');
0050 
0051 nspred=oo_.dr.nspred;
0052 
0053 [kn, np]=size(lpmat);
0054 nshock = length(bayestopt_.pshape)-np;
0055 
0056 nsok = length(find(M_.lead_lag_incidence(M_.maximum_lag,:)));
0057 
0058 js=0;
0059 for j=1:size(anamendo,1),
0060   namendo=deblank(anamendo(j,:));
0061   iendo=strmatch(namendo,M_.endo_names(oo_.dr.order_var,:),'exact');
0062 
0063   iplo=0;
0064   ifig=0;
0065   for jx=1:size(anamexo,1)
0066     namexo=deblank(anamexo(jx,:));
0067     iexo=strmatch(namexo,M_.exo_names,'exact');
0068 
0069     if ~isempty(iexo),
0070       y0=teff(T(iendo,iexo+nspred,:),kn,istable);
0071       if ~isempty(y0),
0072         if mod(iplo,9)==0,
0073           ifig=ifig+1;
0074           hh=dyn_figure(options_,'name',[namendo,' vs. shocks ',int2str(ifig)]);
0075           iplo=0;
0076         end
0077         iplo=iplo+1;
0078         js=js+1;
0079         subplot(3,3,iplo),
0080         [SAmeas, SAMorris] = Morris_Measure_Groups(np+nshock, [lpmat0 lpmat], y0,nliv);
0081         SAM = squeeze(SAMorris(nshock+1:end,1));
0082         SA(:,js)=SAM./(max(SAM)+eps);
0083         [saso, iso] = sort(-SA(:,js));
0084         bar(SA(iso(1:min(np,10)),js))
0085         %set(gca,'xticklabel',pnames(iso(1:min(np,10)),:),'fontsize',8)
0086         set(gca,'xticklabel',' ','fontsize',10)
0087         set(gca,'xlim',[0.5 10.5])
0088         for ip=1:min(np,10),
0089           text(ip,-0.02,deblank(pnames(iso(ip),:)),'rotation',90,'HorizontalAlignment','right','interpreter','none')
0090         end
0091         title([namendo,' vs. ',namexo],'interpreter','none')
0092         if iplo==9,
0093           dyn_saveas(hh,[dirname,'/',M_.fname,'_', namendo,'_vs_shock_',num2str(ifig)],options_);  
0094           if ~options_.nodisplay
0095             close(hh);
0096           end
0097         end
0098 
0099       end
0100     end
0101   end
0102   if iplo<9 & iplo>0 & ifig,
0103     dyn_saveas(hh,[dirname,'/',M_.fname,'_', namendo,'_vs_shocks_',num2str(ifig)],options_);
0104     if ~options_.nodisplay
0105       close(hh);
0106     end
0107   end
0108 
0109   iplo=0;
0110   ifig=0;
0111   for je=1:size(anamlagendo,1)
0112     namlagendo=deblank(anamlagendo(je,:));
0113     ilagendo=strmatch(namlagendo,M_.endo_names(oo_.dr.order_var(oo_.dr.nstatic+1:oo_.dr.nstatic+nsok),:),'exact');
0114 
0115     if ~isempty(ilagendo),
0116       y0=teff(T(iendo,ilagendo,:),kn,istable);
0117       if ~isempty(y0),
0118         if mod(iplo,9)==0,
0119           ifig=ifig+1;
0120           figure('name',[namendo,' vs. lagged endogenous ',int2str(ifig)]),
0121           iplo=0;
0122         end
0123         iplo=iplo+1;
0124         js=js+1;
0125         subplot(3,3,iplo),
0126         [SAmeas, SAMorris] = Morris_Measure_Groups(np+nshock, [lpmat0 lpmat], y0,nliv);
0127         SAM = squeeze(SAMorris(nshock+1:end,1));
0128         SA(:,js)=SAM./(max(SAM)+eps);
0129         [saso, iso] = sort(-SA(:,js));
0130         bar(SA(iso(1:min(np,10)),js))
0131         %set(gca,'xticklabel',pnames(iso(1:min(np,10)),:),'fontsize',8)
0132         set(gca,'xticklabel',' ','fontsize',10)
0133         set(gca,'xlim',[0.5 10.5])
0134         for ip=1:min(np,10),
0135           text(ip,-0.02,deblank(pnames(iso(ip),:)),'rotation',90,'HorizontalAlignment','right','interpreter','none')
0136         end
0137 
0138         title([namendo,' vs. ',namlagendo,'(-1)'],'interpreter','none')
0139         if iplo==9,
0140           dyn_saveas(hh,[dirname,'/',M_.fname,'_', namendo,'_vs_lags_',num2str(ifig)],options_);  
0141           if ~options_.nodisplay
0142             close(hh);
0143           end
0144         end
0145       end
0146     end
0147   end
0148   if iplo<9 & iplo>0 & ifig,
0149     dyn_saveas(hh,[dirname,'/',M_.fname,'_', namendo,'_vs_lags_',num2str(ifig)],options_);      
0150   end
0151 end
0152 
0153 hh=dyn_figure(options_); 
0154 %bar(SA)
0155 % boxplot(SA','whis',10,'symbol','r.')
0156 myboxplot(SA',[],'.',[],10)
0157 set(gca,'xticklabel',' ','fontsize',10,'xtick',[1:np])
0158 set(gca,'xlim',[0.5 np+0.5])
0159 set(gca,'ylim',[0 1])
0160 set(gca,'position',[0.13 0.2 0.775 0.7])
0161 for ip=1:np,
0162   text(ip,-0.02,deblank(pnames(ip,:)),'rotation',90,'HorizontalAlignment','right','interpreter','none')
0163 end
0164 xlabel(' ')
0165 ylabel('Elementary Effects')
0166 title('Reduced form screening')
0167 dyn_saveas(hh,[dirname,'/',M_.fname,'_redform_screen'],options_);

Generated on Mon 21-May-2012 02:42:43 by m2html © 2005