From c4f19586902ef4b5b3ba28eb8a6316e2e615fa94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= Date: Fri, 26 Jan 2018 12:00:27 +0100 Subject: [PATCH] Cosmetic changes + Copyright headers fixes. --- matlab/DsgeSmoother.m | 2 +- matlab/compute_Pinf_Pstar.m | 35 +++++++------------ matlab/dsge_likelihood.m | 2 +- matlab/kalman/likelihood/kalman_filter_d.m | 2 +- .../likelihood/univariate_kalman_filter_d.m | 2 +- 5 files changed, 17 insertions(+), 26 deletions(-) diff --git a/matlab/DsgeSmoother.m b/matlab/DsgeSmoother.m index d83aa07d7..793afa561 100644 --- a/matlab/DsgeSmoother.m +++ b/matlab/DsgeSmoother.m @@ -58,7 +58,7 @@ function [alphahat,etahat,epsilonhat,ahat,SteadyState,trend_coeff,aK,T,R,P,PK,de % SPECIAL REQUIREMENTS % None -% Copyright (C) 2006-2017 Dynare Team +% Copyright (C) 2006-2018 Dynare Team % % This file is part of Dynare. % diff --git a/matlab/compute_Pinf_Pstar.m b/matlab/compute_Pinf_Pstar.m index 4eb5fbc87..0ccbd02d8 100644 --- a/matlab/compute_Pinf_Pstar.m +++ b/matlab/compute_Pinf_Pstar.m @@ -30,7 +30,7 @@ function [Pstar,Pinf] = compute_Pinf_Pstar(mf,T,R,Q,qz_criterium, restrict_colum % SPECIAL REQUIREMENTS % None -% Copyright (C) 2006-2017 Dynare Team +% Copyright (C) 2006-2018 Dynare Team % % This file is part of Dynare. % @@ -52,17 +52,15 @@ if nargin == 6 indx = restrict_columns; indx0=find(~ismember([1:np],indx)); else -% indx=(find(max(abs(T))>0)); -% indx0=(find(max(abs(T))==0)); indx=(find(max(abs(T))>=1.e-10)); indx0=(find(max(abs(T))<1.e-10)); end np0=length(indx0); Tbkp = T; -T0=T(indx0,indx); %static variables vs. dynamic ones -R0=R(indx0,:); % matrix of shocks for static variables +T0=T(indx0,indx); % static variables vs. dynamic ones +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); R=R(indx,:); np = size(T,1); @@ -117,40 +115,33 @@ end if np0 ST1=ST; - - % now I recover stationarized static variables - % using - % ss = s-A*z and + % Now I recover stationarized static variables using + % ss = s-A*z + % and % z-z(-1) (growth rates of unit roots) only depends on stationary variables Pstar = blkdiag(zeros(np0),Pstar); ST = [zeros(length(Pstar),length(indx0)) [T0*QT ;ST]]; 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); iSTinf = inv(STinf); ST0=ST; ST0(:,1:np0+nk)=0; % stationarized static + 1st difference only respond to lagged stationary states ST00 = ST(1:np0,np0+1:np0+nk); % 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 R10 = R1; R10(1:np0,:) = R1(1:np0,:)-ST00*(iSTinf*R1(np0+1:np0+nk,:)); % snip non-stationary part - - % kill non-stationary part before projecting Pstar - ST0(np0+1:np0+nk,:)=0; + % Kill non-stationary part before projecting Pstar + 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!!! - % project Pstar onto static x - Pstar = ... - ST0*Pstar*ST0'+ ... - R10*Q*R10'; - + Pstar = 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 ???? % reorder QT entries else STinf = ST(np0+1:np0+nk,np0+1:np0+nk); - end % stochastic trends with no influence on observed variables are @@ -160,7 +151,7 @@ Pinf(1:nk,1:nk) = eye(nk); if np0 STtriu = STinf-eye(nk); % 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); Pinf = blkdiag(zeros(np0),Pinf); QT = blkdiag(eye(np0),QT); diff --git a/matlab/dsge_likelihood.m b/matlab/dsge_likelihood.m index a6b9071fc..3ea377dcf 100644 --- a/matlab/dsge_likelihood.m +++ b/matlab/dsge_likelihood.m @@ -115,7 +115,7 @@ function [fval,info,exit_flag,DLIK,Hess,SteadyState,trend_coeff,Model,DynareOpti %! @end deftypefn %@eod: -% Copyright (C) 2004-2017 Dynare Team +% Copyright (C) 2004-2018 Dynare Team % % This file is part of Dynare. % diff --git a/matlab/kalman/likelihood/kalman_filter_d.m b/matlab/kalman/likelihood/kalman_filter_d.m index 48c0d91c4..7a7cdef13 100644 --- a/matlab/kalman/likelihood/kalman_filter_d.m +++ b/matlab/kalman/likelihood/kalman_filter_d.m @@ -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, % 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. % diff --git a/matlab/kalman/likelihood/univariate_kalman_filter_d.m b/matlab/kalman/likelihood/univariate_kalman_filter_d.m index b3038a312..81f7d5778 100644 --- a/matlab/kalman/likelihood/univariate_kalman_filter_d.m +++ b/matlab/kalman/likelihood/univariate_kalman_filter_d.m @@ -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, % 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. %