Home > matlab > disp_identification.m

disp_identification

PURPOSE ^

Copyright (C) 2008-2011 Dynare Team

SYNOPSIS ^

function disp_identification(pdraws, idemodel, idemoments, name)

DESCRIPTION ^

 Copyright (C) 2008-2011 Dynare Team

 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
 along with Dynare.  If not, see <http://www.gnu.org/licenses/>.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function disp_identification(pdraws, idemodel, idemoments, name)
0002 
0003 % Copyright (C) 2008-2011 Dynare Team
0004 %
0005 % This file is part of Dynare.
0006 %
0007 % Dynare is free software: you can redistribute it and/or modify
0008 % it under the terms of the GNU General Public License as published by
0009 % the Free Software Foundation, either version 3 of the License, or
0010 % (at your option) any later version.
0011 %
0012 % Dynare is distributed in the hope that it will be useful,
0013 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0014 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015 % GNU General Public License for more details.
0016 %
0017 % You should have received a copy of the GNU General Public License
0018 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0019 
0020 global options_
0021 
0022 [SampleSize, npar] = size(pdraws);
0023 % jok = 0;
0024 % jokP = 0;
0025 % jokJ = 0;
0026 % jokPJ = 0;
0027 
0028 % for j=1:npar,
0029 %     %     if any(idemodel.ind(j,:)==0),
0030 %     %         pno = 100*length(find(idemodel.ind(j,:)==0))/SampleSize;
0031 %     %         disp(['Parameter ',name{j},' is not identified in the model for ',num2str(pno),'% of MC runs!' ])
0032 %     %         disp(' ')
0033 %     %     end
0034 %     %     if any(idemoments.ind(j,:)==0),
0035 %     %         pno = 100*length(find(idemoments.ind(j,:)==0))/SampleSize;
0036 %     %         disp(['Parameter ',name{j},' is not identified by J moments for ',num2str(pno),'% of MC runs!' ])
0037 %     %         disp(' ')
0038 %     %     end
0039 %     if any(idemodel.ind(j,:)==1),
0040 %         iok = find(idemodel.ind(j,:)==1);
0041 %         jok = jok+1;
0042 %         kok(jok) = j;
0043 %         mmin(jok,1) = min(idemodel.Mco(j,iok));
0044 %         mmean(jok,1) = mean(idemodel.Mco(j,iok));
0045 %         mmax(jok,1) = max(idemodel.Mco(j,iok));
0046 %         [ipmax, jpmax] = find(abs(squeeze(idemodel.Pco(j,[1:j-1,j+1:end],iok)))>0.95);
0047 %         if ~isempty(ipmax)
0048 %             jokP = jokP+1;
0049 %             kokP(jokP) = j;
0050 %             ipmax(find(ipmax>=j))=ipmax(find(ipmax>=j))+1;
0051 %             [N,X]=hist(ipmax,[1:npar]);
0052 %             jpM(jokP)={find(N)};
0053 %             NPM(jokP)={N(find(N))./SampleSize.*100};
0054 %             pmeanM(jokP)={mean(squeeze(idemodel.Pco(j,find(N),iok))')};
0055 %             pminM(jokP)={min(squeeze(idemodel.Pco(j,find(N),iok))')};
0056 %             pmaxM(jokP)={max(squeeze(idemodel.Pco(j,find(N),iok))')};
0057 %         end
0058 %     end
0059 %     if any(idemoments.ind(j,:)==1),
0060 %         iok = find(idemoments.ind(j,:)==1);
0061 %         jokJ = jokJ+1;
0062 %         kokJ(jokJ) = j;
0063 %         mminJ(jokJ,1) = min(idemoments.Mco(j,iok));
0064 %         mmeanJ(jokJ,1) = mean(idemoments.Mco(j,iok));
0065 %         mmaxJ(jokJ,1) = max(idemoments.Mco(j,iok));
0066 %         [ipmax, jpmax] = find(abs(squeeze(idemoments.Pco(j,[1:j-1,j+1:end],iok)))>0.95);
0067 %         if ~isempty(ipmax)
0068 %             jokPJ = jokPJ+1;
0069 %             kokPJ(jokPJ) = j;
0070 %             ipmax(find(ipmax>=j))=ipmax(find(ipmax>=j))+1;
0071 %             [N,X]=hist(ipmax,[1:npar]);
0072 %             jpJ(jokPJ)={find(N)};
0073 %             NPJ(jokPJ)={N(find(N))./SampleSize.*100};
0074 %             pmeanJ(jokPJ)={mean(squeeze(idemoments.Pco(j,find(N),iok))')};
0075 %             pminJ(jokPJ)={min(squeeze(idemoments.Pco(j,find(N),iok))')};
0076 %             pmaxJ(jokPJ)={max(squeeze(idemoments.Pco(j,find(N),iok))')};
0077 %         end
0078 %     end
0079 % end
0080 
0081 disp(['  ']),
0082 
0083 if any(idemodel.ino),
0084     disp('WARNING !!!')
0085     if SampleSize>1,
0086         disp(['The rank of H (model) is deficient for ', num2str(length(find(idemodel.ino))),' out of ',int2str(SampleSize),' MC runs!'  ]),
0087     else
0088         disp(['The rank of H (model) is deficient!'  ]),
0089     end
0090     disp(' ')
0091     for j=1:npar,
0092         if any(idemodel.ind0(:,j)==0),
0093             pno = 100*length(find(idemodel.ind0(:,j)==0))/SampleSize;
0094             if SampleSize>1
0095                 disp(['    ',name{j},' is not identified in the model for ',num2str(pno),'% of MC runs!' ])
0096             else
0097                 disp(['    ',name{j},' is not identified in the model!' ])
0098             end
0099             disp(['    [dJ/d(',name{j},')=0 for all tau elements in the model solution!]' ])
0100         end
0101     end
0102     npairs=size(idemodel.jweak_pair,2);
0103     jmap_pair=dyn_unvech(1:npairs);
0104     jstore=[];
0105     disp(' ')
0106     for j=1:npairs,
0107         iweak = length(find(idemodel.jweak_pair(:,j)));
0108         if iweak,
0109             [jx,jy]=find(jmap_pair==j);
0110             jstore=[jstore jx(1) jy(1)];
0111             if SampleSize > 1
0112                 disp(['    [',name{jx(1)},',',name{jy(1)},'] are PAIRWISE collinear (with tol = 1.e-10) for ',num2str((iweak)/SampleSize*100),'% of MC runs!' ])
0113             else
0114                 disp(['    [',name{jx(1)},',',name{jy(1)},'] are PAIRWISE collinear (with tol = 1.e-10) !' ])
0115             end
0116         end
0117         
0118     end
0119     disp(' ')
0120     for j=1:npar,
0121         iweak = length(find(idemodel.jweak(:,j)));
0122         if iweak && ~ismember(j,jstore),
0123             %         disp('WARNING !!!')
0124             %         disp(['Model derivatives of parameter ',name{j},' are multi-collinear (with tol = 1.e-10) for ',num2str(iweak/SampleSize*100),'% of MC runs!' ])
0125             if SampleSize>1
0126                 disp([name{j},' is collinear w.r.t. all other params ',num2str(iweak/SampleSize*100),'% of MC runs!' ])
0127             else
0128                 disp([name{j},' is collinear w.r.t. all other params!' ])
0129             end
0130         end
0131     end
0132 %         if npar>(j+1),
0133 %             [ipair, jpair] = find(squeeze(idemodel.Pco(j,j+1:end,:))'>(1-1.e-10));
0134 %         else
0135 %             [ipair, jpair] = find(squeeze(idemodel.Pco(j,j+1:end,:))>(1-1.e-10));
0136 %         end
0137 %         if ~isempty(jpair),
0138 %             for jx=j+1:npar,
0139 %                 ixp = find(jx==(jpair+j));
0140 %                 if ~isempty(ixp)
0141 %                     if SampleSize > 1,
0142 %                         disp(['    [',name{j},',',name{jx},'] are PAIRWISE collinear (with tol = 1.e-10) for ',num2str(length(ixp)/SampleSize*100),'% of MC runs!' ])
0143 %                     else
0144 %                         disp(['    [',name{j},',',name{jx},'] are PAIRWISE collinear (with tol = 1.e-10)!' ])
0145 %                     end
0146 %                 end
0147 %             end
0148 %         end
0149 end
0150 
0151 if ~any(idemodel.ino) && ~any(any(idemodel.ind0==0))
0152     disp(['All parameters are identified in the model (rank of H).' ]),
0153     disp(' ')
0154 end
0155 
0156 if any(idemoments.ino),
0157     disp(' ')
0158     disp('WARNING !!!')
0159     if SampleSize > 1,
0160         disp(['The rank of J (moments) is deficient for ', num2str(length(find(idemoments.ino))),' out of ',int2str(SampleSize),' MC runs!'  ]),
0161     else
0162         disp(['The rank of J (moments) is deficient!'  ]),
0163     end
0164     %     disp('WARNING !!!')
0165     %     disp(['The rank of J (moments) is deficient for ', num2str(length(find(idemoments.ino))/SampleSize*100),'% of MC runs!'  ]),
0166 %     indno=[];
0167 %     for j=1:SampleSize, indno=[indno;idemoments.indno{j}]; end
0168 %     freqno = mean(indno)*100;
0169 %     ifreq=find(freqno);
0170     %     disp('MOMENT RANK FAILURE DUE TO COLLINEARITY OF PARAMETERS:');
0171     disp(' ')
0172     for j=1:npar,
0173         if any(idemoments.ind0(:,j)==0),
0174             pno = 100*length(find(idemoments.ind0(:,j)==0))/SampleSize;
0175             if SampleSize > 1
0176                 disp(['    ',name{j},' is not identified by J moments for ',num2str(pno),'% of MC runs!' ])
0177             else
0178                 disp(['    ',name{j},' is not identified by J moments!' ])
0179             end
0180             disp(['    [dJ/d(',name{j},')=0 for all J moments!]' ])
0181         end
0182     end
0183     disp(' ')
0184     npairs=size(idemoments.jweak_pair,2);
0185     jmap_pair=dyn_unvech(1:npairs);
0186     jstore=[];
0187     for j=1:npairs,
0188         iweak = length(find(idemoments.jweak_pair(:,j)));
0189         if iweak,
0190             [jx,jy]=find(jmap_pair==j);
0191             jstore=[jstore'  jx(1) jy(1)]';
0192             if SampleSize > 1
0193                 disp(['    [',name{jx(1)},',',name{jy(1)},'] are PAIRWISE collinear (with tol = 1.e-10) for ',num2str((iweak)/SampleSize*100),'% of MC runs!' ])
0194             else
0195                 disp(['    [',name{jx(1)},',',name{jy(1)},'] are PAIRWISE collinear (with tol = 1.e-10) !' ])
0196             end
0197         end
0198         
0199     end
0200     disp(' ')
0201     for j=1:npar,
0202         iweak = length(find(idemoments.jweak(:,j)));
0203         if iweak && ~ismember(j,jstore),
0204             %             disp('WARNING !!!')
0205             %             disp(['Moment derivatives of parameter ',name{j},' are multi-collinear (with tol = 1.e-10) for ',num2str(iweak/SampleSize*100),'% of MC runs!' ])
0206             if SampleSize > 1,
0207                 disp([name{j},' is collinear w.r.t. all other params ',num2str(iweak/SampleSize*100),'% of MC runs!' ])
0208             else
0209                 disp([name{j},' is collinear w.r.t. all other params!' ])
0210             end
0211         end
0212     end
0213 %             if npar>(j+1),
0214 %                 [ipair, jpair] = find(squeeze(idemoments.Pco(j,j+1:end,:))'>(1-1.e-10));
0215 %             else
0216 %                 [ipair, jpair] = find(squeeze(idemoments.Pco(j,j+1:end,:))>(1-1.e-10));
0217 %             end
0218 %             if ~isempty(jpair),
0219 %                 for jx=j+1:npar,
0220 %                     ixp = find(jx==(jpair+j));
0221 %                     if ~isempty(ixp)
0222 %                         if SampleSize > 1
0223 %                             disp(['    [',name{j},',',name{jx},'] are PAIRWISE collinear (with tol = 1.e-10) for ',num2str(length(ixp)/SampleSize*100),'% of MC runs!' ])
0224 %                         else
0225 %                             disp(['    [',name{j},',',name{jx},'] are PAIRWISE collinear (with tol = 1.e-10) !' ])
0226 %                         end
0227 %                     end
0228 %                 end
0229 %             end
0230 %         end
0231 %     end
0232 end
0233 if ~any(idemoments.ino) && ~any(any(idemoments.ind0==0))
0234     disp(' ')
0235     disp(['All parameters are identified by J moments (rank of J)' ]),
0236     disp(' ')
0237 end
0238 
0239 % if ~ options_.noprint && advanced,
0240 %     disp('Press KEY to continue with identification analysis')
0241 %     pause;
0242 %     dyntable('Multi collinearity in the model:',char('param','min','mean','max'), ...
0243 %              char(name(kok)),[mmin, mmean, mmax],10,10,6);
0244 %     disp(' ')
0245 %     dyntable('Multi collinearity for moments in J:',char('param','min','mean','max'), ...
0246 %              char(name(kokJ)),[mminJ, mmeanJ, mmaxJ],10,10,6);
0247 %     disp(' ')
0248 % end
0249 
0250 
0251 % if advanced && (~options_.noprint),
0252 %     for j=1:length(kokP),
0253 %         dyntable([name{kokP(j)},' pairwise correlations in the model'],char(' ','min','mean','max'), ...
0254 %                  char(name{jpM{j}}),[pminM{j}' pmeanM{j}' pmaxM{j}'],10,10,3);
0255 %     end
0256 %
0257 %     for j=1:length(kokPJ),
0258 %         dyntable([name{kokPJ(j)},' pairwise correlations in J moments'],char(' ','min','mean','max'), ...
0259 %                  char(name{jpJ{j}}),[pminJ{j}' pmeanJ{j}' pmaxJ{j}'],10,10,3);
0260 %     end
0261 % end
0262 % disp(' ')
0263

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