From 3d410b9b8b287fe104d1f0ee99df6f88188a9dfc Mon Sep 17 00:00:00 2001 From: michel Date: Mon, 27 Oct 2008 19:47:22 +0000 Subject: [PATCH] v4.1: corrected DsgeSmoother.m for unobserved trends git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@2219 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 86ffbd175..f53899382 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