Home > matlab > gsa > stab_map_2.m

stab_map_2

PURPOSE ^

function stab_map_2(x, alpha2, pvalue, fnam, dirname)

SYNOPSIS ^

function stab_map_2(x,alpha2, pvalue, fnam, dirname,xparam1)

DESCRIPTION ^

 function stab_map_2(x, alpha2, pvalue, fnam, dirname)

 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 stab_map_2(x,alpha2, pvalue, fnam, dirname,xparam1)
0002 % function stab_map_2(x, alpha2, pvalue, fnam, dirname)
0003 %
0004 % Written by Marco Ratto
0005 % Joint Research Centre, The European Commission,
0006 % (http://eemc.jrc.ec.europa.eu/),
0007 % marco.ratto@jrc.it
0008 %
0009 % Reference:
0010 % M. Ratto, Global Sensitivity Analysis for Macroeconomic models, MIMEO, 2006.
0011 
0012 % Copyright (C) 2012 Dynare Team
0013 %
0014 % This file is part of Dynare.
0015 %
0016 % Dynare is free software: you can redistribute it and/or modify
0017 % it under the terms of the GNU General Public License as published by
0018 % the Free Software Foundation, either version 3 of the License, or
0019 % (at your option) any later version.
0020 %
0021 % Dynare is distributed in the hope that it will be useful,
0022 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0023 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0024 % GNU General Public License for more details.
0025 %
0026 % You should have received a copy of the GNU General Public License
0027 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0028 
0029 %global bayestopt_ estim_params_ dr_ options_ ys_ fname_
0030 global bayestopt_ estim_params_ options_ oo_ M_
0031 
0032 npar=size(x,2);
0033 nsam=size(x,1);
0034 ishock= npar>estim_params_.np;
0035 if nargin<4,
0036   fnam='';
0037 end
0038 if nargin<5,
0039   dirname='';
0040 end
0041 if nargin<6,
0042   xparam1=[];
0043 end
0044 
0045 ys_ = oo_.dr.ys;
0046 dr_ = oo_.dr;
0047 fname_ = M_.fname;
0048 nshock = estim_params_.nvx;
0049 nshock = nshock + estim_params_.nvn;
0050 nshock = nshock + estim_params_.ncx;
0051 nshock = nshock + estim_params_.ncn;
0052 
0053 c0=corrcoef(x);
0054 c00=tril(c0,-1);
0055 fig_nam_=[fname_,'_',fnam,'_corr_'];
0056 
0057 ifig=0;
0058 j2=0;
0059 if ishock==0
0060   npar=estim_params_.np;
0061   if ~isempty(xparam1),
0062       xparam1=xparam1(nshock+1:end);
0063   end
0064 else
0065   npar=estim_params_.np+nshock;
0066 end
0067 for j=1:npar,
0068   i2=find(abs(c00(:,j))>alpha2);
0069   if length(i2)>0,
0070     for jx=1:length(i2),
0071           tval  = abs(c00(i2(jx),j)*sqrt( (nsam-2)/(1-c00(i2(jx),j)^2) ));
0072           tcr = tcrit(nsam-2,pvalue);
0073           if tval>tcr,
0074       j2=j2+1;
0075       if mod(j2,12)==1,
0076         ifig=ifig+1;
0077         hh=dyn_figure(options_,'name',['Correlations in the ',fnam,' sample ', num2str(ifig)]);
0078       end
0079       subplot(3,4,j2-(ifig-1)*12)
0080       %             bar(c0(i2,j)),
0081       %             set(gca,'xticklabel',bayestopt_.name(i2)),
0082       %             set(gca,'xtick',[1:length(i2)])
0083       %plot(stock_par(ixx(nfilt+1:end,i),j),stock_par(ixx(nfilt+1:end,i),i2(jx)),'.k')
0084       %hold on,
0085       plot(x(:,j),x(:,i2(jx)),'.')
0086       if ~isempty(xparam1)
0087           hold on, plot(xparam1(j),xparam1(i2(jx)),'ro')
0088       end
0089       %             xlabel(deblank(estim_params_.param_names(j,:)),'interpreter','none'),
0090       %             ylabel(deblank(estim_params_.param_names(i2(jx),:)),'interpreter','none'),
0091       if ishock,
0092         xlabel(bayestopt_.name{j},'interpreter','none'), 
0093         ylabel(bayestopt_.name{i2(jx)},'interpreter','none'), 
0094       else
0095         xlabel(bayestopt_.name{j+nshock},'interpreter','none'), 
0096         ylabel(bayestopt_.name{i2(jx)+nshock},'interpreter','none'), 
0097       end
0098       title(['cc = ',num2str(c0(i2(jx),j))])
0099       if (mod(j2,12)==0) && j2>0,
0100         dyn_saveas(hh,[dirname,'/',fig_nam_,int2str(ifig)],options_);
0101         if ~options_.nodisplay
0102           close(hh);
0103         end
0104       end
0105           end
0106           
0107     end
0108   end
0109   if (j==(npar)) && j2>0,
0110     dyn_saveas(hh,[dirname,'/',fig_nam_,int2str(ifig)],options_);
0111   end
0112   
0113 end
0114 if ifig==0,
0115   disp(['No correlation term >', num2str(alpha2),' found for ',fnam])
0116 end
0117 %close all

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