Skip to content
Snippets Groups Projects
Commit 94d215d7 authored by ratto's avatar ratto
Browse files

Modifications linked to previous commit:

Added first order moments 
Added LRE analysis for trivial no-identification

git-svn-id: https://www.dynare.org/svn/dynare/trunk@3361 ac1d8469-bf42-47a9-8791-bf33cf982152
parent cda0f571
No related branches found
No related tags found
No related merge requests found
function [H, dA, dOm, Hss, info] = getH(A, B, M_,oo_,kronflag,indx,indexo) function [H, dA, dOm, Hss, gp, info] = getH(A, B, M_,oo_,kronflag,indx,indexo)
% computes derivative of reduced form linear model w.r.t. deep params % computes derivative of reduced form linear model w.r.t. deep params
% %
......
function [JJ, H, gam] = getJJ(A, B, M_,oo_,options_,kronflag,indx,indexo,mf,nlags,useautocorr) function [JJ, H, gam, gp] = getJJ(A, B, M_,oo_,options_,kronflag,indx,indexo,mf,nlags,useautocorr)
% Copyright (C) 2009 Dynare Team % Copyright (C) 2009 Dynare Team
% %
...@@ -36,14 +36,14 @@ if kronflag == -1, ...@@ -36,14 +36,14 @@ if kronflag == -1,
assignin('base','M_', M_); assignin('base','M_', M_);
assignin('base','oo_', oo_); assignin('base','oo_', oo_);
else else
[H, dA, dOm, dYss] = getH(A, B, M_,oo_,kronflag,indx,indexo); [H, dA, dOm, dYss, gp] = getH(A, B, M_,oo_,kronflag,indx,indexo);
gp = reshape(gp,size(gp,1)*size(gp,2),size(gp,3));
% if isempty(H), % if isempty(H),
% JJ = []; % JJ = [];
% GAM = []; % GAM = [];
% return % return
% end % end
m = length(A); m = length(A);
GAM = lyapunov_symm(A,B*M_.Sigma_e*B',options_.qz_criterium,options_.lyapunov_complex_threshold,1); GAM = lyapunov_symm(A,B*M_.Sigma_e*B',options_.qz_criterium,options_.lyapunov_complex_threshold,1);
k = find(abs(GAM) < 1e-12); k = find(abs(GAM) < 1e-12);
GAM(k) = 0; GAM(k) = 0;
......
function [McoH, McoJ, PcoH, PcoJ, condH, condJ, eH, eJ, ind01, ind02, indnoH, indnoJ] = identification_checks(H,JJ, bayestopt_) function [McoH, McoJ, McoGP, PcoH, PcoJ, PcoGP, condH, condJ, condGP, eH, eJ, eGP, ind01, ind02, indnoH, indnoJ] = identification_checks(H,JJ, gp, bayestopt_)
% Copyright (C) 2008 Dynare Team % Copyright (C) 2008 Dynare Team
% %
...@@ -22,8 +22,10 @@ function [McoH, McoJ, PcoH, PcoJ, condH, condJ, eH, eJ, ind01, ind02, indnoH, in ...@@ -22,8 +22,10 @@ function [McoH, McoJ, PcoH, PcoJ, condH, condJ, eH, eJ, ind01, ind02, indnoH, in
% 1. check rank of H at theta % 1. check rank of H at theta
npar = size(H,2); npar = size(H,2);
npar0 = size(gp,2);
indnoH = {}; indnoH = {};
indnoJ = {}; indnoJ = {};
indnoLRE = {};
ind1 = find(vnorm(H)~=0); ind1 = find(vnorm(H)~=0);
H1 = H(:,ind1); H1 = H(:,ind1);
covH = H1'*H1; covH = H1'*H1;
...@@ -50,6 +52,19 @@ eJ(find(vnorm(JJ)==0),1:length(find(vnorm(JJ)==0)))=eye(length(find(vnorm(JJ)==0 ...@@ -50,6 +52,19 @@ eJ(find(vnorm(JJ)==0),1:length(find(vnorm(JJ)==0)))=eye(length(find(vnorm(JJ)==0
% condJ = cond(JJ1'*JJ1); % condJ = cond(JJ1'*JJ1);
condJ = cond(JJ1); condJ = cond(JJ1);
ind3 = find(vnorm(gp)~=0);
gp1 = gp(:,ind3);
covgp = gp1'*gp1;
sdgp = sqrt(diag(covgp));
sdgp = sdgp*sdgp';
[ex1,ex2] = eig( (gp1'*gp1)./sdgp );
% eJ = NaN(npar,length(ind2));
eGP = zeros(npar0,npar0);
eGP(ind3,length(find(vnorm(gp)==0))+1:end) = ex1;
eGP(find(vnorm(gp)==0),1:length(find(vnorm(gp)==0)))=eye(length(find(vnorm(gp)==0)));
% condJ = cond(JJ1'*JJ1);
condGP = cond(gp1);
if rank(H)<npar if rank(H)<npar
ixno = 0; ixno = 0;
% - find out which parameters are involved, % - find out which parameters are involved,
...@@ -106,12 +121,16 @@ end ...@@ -106,12 +121,16 @@ end
McoH = NaN(npar,1); McoH = NaN(npar,1);
McoJ = NaN(npar,1); McoJ = NaN(npar,1);
McoGP = NaN(npar0,1);
for ii = 1:size(H1,2); for ii = 1:size(H1,2);
McoH(ind1(ii),:) = [cosn([H1(:,ii),H1(:,find([1:1:size(H1,2)]~=ii))])]; McoH(ind1(ii),:) = [cosn([H1(:,ii),H1(:,find([1:1:size(H1,2)]~=ii))])];
end end
for ii = 1:size(JJ1,2); for ii = 1:size(JJ1,2);
McoJ(ind2(ii),:) = [cosn([JJ1(:,ii),JJ1(:,find([1:1:size(JJ1,2)]~=ii))])]; McoJ(ind2(ii),:) = [cosn([JJ1(:,ii),JJ1(:,find([1:1:size(JJ1,2)]~=ii))])];
end end
for ii = 1:size(gp1,2);
McoGP(ind3(ii),:) = [cosn([gp1(:,ii),gp1(:,find([1:1:size(gp1,2)]~=ii))])];
end
% format long % some are nearly 1 % format long % some are nearly 1
% McoJ % McoJ
...@@ -123,6 +142,7 @@ end ...@@ -123,6 +142,7 @@ end
PcoH = NaN(npar,npar); PcoH = NaN(npar,npar);
PcoJ = NaN(npar,npar); PcoJ = NaN(npar,npar);
PcoGP = NaN(npar0,npar0);
for ii = 1:size(H1,2); for ii = 1:size(H1,2);
for jj = 1:size(H1,2); for jj = 1:size(H1,2);
PcoH(ind1(ii),ind1(jj)) = [cosn([H1(:,ii),H1(:,jj)])]; PcoH(ind1(ii),ind1(jj)) = [cosn([H1(:,ii),H1(:,jj)])];
...@@ -135,6 +155,13 @@ for ii = 1:size(JJ1,2); ...@@ -135,6 +155,13 @@ for ii = 1:size(JJ1,2);
end end
end end
for ii = 1:size(gp1,2);
for jj = 1:size(gp1,2);
PcoGP(ind3(ii),ind3(jj)) = [cosn([gp1(:,ii),gp1(:,jj)])];
end
end
ind01 = zeros(npar,1); ind01 = zeros(npar,1);
ind02 = zeros(npar,1); ind02 = zeros(npar,1);
ind01(ind1) = 1; ind01(ind1) = 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment