Cosmetic changes + Copyright headers fixes.

time-shift
Stéphane Adjemian (Charybdis) 2018-01-26 12:00:27 +01:00
parent b933a440bf
commit c4f1958690
5 changed files with 17 additions and 26 deletions

View File

@ -58,7 +58,7 @@ function [alphahat,etahat,epsilonhat,ahat,SteadyState,trend_coeff,aK,T,R,P,PK,de
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% None % None
% Copyright (C) 2006-2017 Dynare Team % Copyright (C) 2006-2018 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %

View File

@ -30,7 +30,7 @@ function [Pstar,Pinf] = compute_Pinf_Pstar(mf,T,R,Q,qz_criterium, restrict_colum
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% None % None
% Copyright (C) 2006-2017 Dynare Team % Copyright (C) 2006-2018 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
@ -52,17 +52,15 @@ if nargin == 6
indx = restrict_columns; indx = restrict_columns;
indx0=find(~ismember([1:np],indx)); indx0=find(~ismember([1:np],indx));
else else
% indx=(find(max(abs(T))>0));
% indx0=(find(max(abs(T))==0));
indx=(find(max(abs(T))>=1.e-10)); indx=(find(max(abs(T))>=1.e-10));
indx0=(find(max(abs(T))<1.e-10)); indx0=(find(max(abs(T))<1.e-10));
end end
np0=length(indx0); np0=length(indx0);
Tbkp = T; Tbkp = T;
T0=T(indx0,indx); %static variables vs. dynamic ones T0=T(indx0,indx); % static variables vs. dynamic ones
R0=R(indx0,:); % matrix of shocks for static variables R0=R(indx0,:); % matrix of shocks for static variables
% perform Kitagawa transformation only for non-zero columns of T % Perform Kitagawa transformation only for non-zero columns of T
T=T(indx,indx); T=T(indx,indx);
R=R(indx,:); R=R(indx,:);
np = size(T,1); np = size(T,1);
@ -117,40 +115,33 @@ end
if np0 if np0
ST1=ST; ST1=ST;
% Now I recover stationarized static variables using
% now I recover stationarized static variables % ss = s-A*z
% using % and
% ss = s-A*z and
% z-z(-1) (growth rates of unit roots) only depends on stationary variables % z-z(-1) (growth rates of unit roots) only depends on stationary variables
Pstar = blkdiag(zeros(np0),Pstar); Pstar = blkdiag(zeros(np0),Pstar);
ST = [zeros(length(Pstar),length(indx0)) [T0*QT ;ST]]; ST = [zeros(length(Pstar),length(indx0)) [T0*QT ;ST]];
R1 = [R0; R1]; R1 = [R0; R1];
% build the matrix for stationarized variables % Build the matrix for stationarized variables
STinf = ST(np0+1:np0+nk,np0+1:np0+nk); STinf = ST(np0+1:np0+nk,np0+1:np0+nk);
iSTinf = inv(STinf); iSTinf = inv(STinf);
ST0=ST; ST0=ST;
ST0(:,1:np0+nk)=0; % stationarized static + 1st difference only respond to lagged stationary states ST0(:,1:np0+nk)=0; % stationarized static + 1st difference only respond to lagged stationary states
ST00 = ST(1:np0,np0+1:np0+nk); ST00 = ST(1:np0,np0+1:np0+nk);
% A\B is the matrix division of A into B, which is roughly the % A\B is the matrix division of A into B, which is roughly the
% same as INV(A)*B % same as INV(A)*B
ST0(1:np0,np0+nk+1:end) = ST(1:np0,np0+nk+1:end)-ST00*(iSTinf*ST(np0+1:np0+nk,np0+nk+1:end)); % snip non-stationary part ST0(1:np0,np0+nk+1:end) = ST(1:np0,np0+nk+1:end)-ST00*(iSTinf*ST(np0+1:np0+nk,np0+nk+1:end)); % snip non-stationary part
R10 = R1; R10 = R1;
R10(1:np0,:) = R1(1:np0,:)-ST00*(iSTinf*R1(np0+1:np0+nk,:)); % snip non-stationary part R10(1:np0,:) = R1(1:np0,:)-ST00*(iSTinf*R1(np0+1:np0+nk,:)); % snip non-stationary part
% Kill non-stationary part before projecting Pstar
% kill non-stationary part before projecting Pstar ST0(np0+1:np0+nk,:)=0;
ST0(np0+1:np0+nk,:)=0;
R10(np0+1:np0+nk,:)=0; % is this questionable???? IT HAS TO in order to match Michel's version!!! R10(np0+1:np0+nk,:)=0; % is this questionable???? IT HAS TO in order to match Michel's version!!!
% project Pstar onto static x % project Pstar onto static x
Pstar = ... Pstar = ST0*Pstar*ST0'+R10*Q*R10';
ST0*Pstar*ST0'+ ...
R10*Q*R10';
% QT(1:np0,np0+1:np0+nk) = QT(1:np0,np0+1:np0+nk)+ST(1:np0,np0+1:np0+nk); %%% is this questionable ???? % QT(1:np0,np0+1:np0+nk) = QT(1:np0,np0+1:np0+nk)+ST(1:np0,np0+1:np0+nk); %%% is this questionable ????
% reorder QT entries % reorder QT entries
else else
STinf = ST(np0+1:np0+nk,np0+1:np0+nk); STinf = ST(np0+1:np0+nk,np0+1:np0+nk);
end end
% stochastic trends with no influence on observed variables are % stochastic trends with no influence on observed variables are
@ -160,7 +151,7 @@ Pinf(1:nk,1:nk) = eye(nk);
if np0 if np0
STtriu = STinf-eye(nk); STtriu = STinf-eye(nk);
% A\B is the matrix division of A into B, which is roughly the % A\B is the matrix division of A into B, which is roughly the
% same as INV(A)*B % same as INV(A)*B
STinf0 = ST00*(eye(nk)-iSTinf*STtriu); STinf0 = ST00*(eye(nk)-iSTinf*STtriu);
Pinf = blkdiag(zeros(np0),Pinf); Pinf = blkdiag(zeros(np0),Pinf);
QT = blkdiag(eye(np0),QT); QT = blkdiag(eye(np0),QT);

View File

@ -115,7 +115,7 @@ function [fval,info,exit_flag,DLIK,Hess,SteadyState,trend_coeff,Model,DynareOpti
%! @end deftypefn %! @end deftypefn
%@eod: %@eod:
% Copyright (C) 2004-2017 Dynare Team % Copyright (C) 2004-2018 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %

View File

@ -36,7 +36,7 @@ function [dLIK,dlik,a,Pstar] = kalman_filter_d(Y, start, last, a, Pinf, Pstar, k
% Durbin/Koopman (2012): "Time Series Analysis by State Space Methods", Oxford University Press, % Durbin/Koopman (2012): "Time Series Analysis by State Space Methods", Oxford University Press,
% Second Edition, Ch. 5 and 7.2 % Second Edition, Ch. 5 and 7.2
% Copyright (C) 2004-2017 Dynare Team % Copyright (C) 2004-2018 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %

View File

@ -87,7 +87,7 @@ function [dLIK, dlikk, a, Pstar, llik] = univariate_kalman_filter_d(data_index,
% Series Analysis by State Space Methods", Oxford University Press, % Series Analysis by State Space Methods", Oxford University Press,
% Second Edition, Ch. 5, 6.4 + 7.2.5 % Second Edition, Ch. 5, 6.4 + 7.2.5
% Copyright (C) 2004-2017 Dynare Team % Copyright (C) 2004-2018 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %