From 29df32c41d1bff78e8b6557ef05cb71009f3db5f Mon Sep 17 00:00:00 2001 From: michel <michel@ac1d8469-bf42-47a9-8791-bf33cf982152> Date: Mon, 27 Oct 2008 19:43:19 +0000 Subject: [PATCH] v4.0: corrected DsgeSmoother for unobserved trend git-svn-id: https://www.dynare.org/svn/dynare/branches/4.0@2218 ac1d8469-bf42-47a9-8791-bf33cf982152 --- matlab/DsgeSmoother.m | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/matlab/DsgeSmoother.m b/matlab/DsgeSmoother.m index 86ffbd175d..f538993823 100644 --- a/matlab/DsgeSmoother.m +++ b/matlab/DsgeSmoother.m @@ -181,15 +181,14 @@ function [alphahat,etahat,epsilonhat,ahat,SteadyState,trend_coeff,aK,T,R,P,PK,d, Z = QT(mf,:); R1 = QT'*R; -% $$$ [u,s,v]=svd(Z*ST(:,1:nk),0); -% $$$ k = find(abs(diag(s)) < 1e-8); -% $$$ if length(k) > 0 -% $$$ [junk,k1] = max(abs(v(:,k))); -% $$$ dd =ones(nk,1); -% $$$ dd(k1) = zeros(length(k1),1); -% $$$ Pinf(1:nk,1:nk) = diag(dd); -% $$$ end - Pinf(1:nk,1:nk) = eye(nk); + [QQ,RR,EE] = qr(Z*ST(:,1:nk),0); + k = find(abs(diag(RR)) < 1e-8); + if length(k) > 0 + k1 = EE(:,k); + dd =ones(nk,1); + dd(k1) = zeros(length(k1),1); + Pinf(1:nk,1:nk) = diag(dd); + end end % ----------------------------------------------------------------------------- % 4. Kalman smoother -- GitLab