0001 function stab_map_2(x,alpha2, pvalue, fnam, dirname,xparam1)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
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
0081
0082
0083
0084
0085 plot(x(:,j),x(:,i2(jx)),'.')
0086 if ~isempty(xparam1)
0087 hold on, plot(xparam1(j),xparam1(i2(jx)),'ro')
0088 end
0089
0090
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