From 47353a276b0abdb12629ff424b93ccd2af288114 Mon Sep 17 00:00:00 2001 From: Marco Ratto Date: Thu, 2 Aug 2012 14:57:20 +0200 Subject: [PATCH] bug fix: the anlytic hessian was wrong with estimated stderr. Manual cherry pick from Commit: 36853cb7615de41ca61ed92decf8bbe81ab40cba --- matlab/dsge_likelihood.m | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/matlab/dsge_likelihood.m b/matlab/dsge_likelihood.m index 0b770a0d4..3629c9e50 100644 --- a/matlab/dsge_likelihood.m +++ b/matlab/dsge_likelihood.m @@ -568,16 +568,16 @@ if analytic_derivation, if full_Hess DTj = DT(:,:,j+offset); DPj = dum; - for i=1:j, - DTi = DT(:,:,i+offset); - DPi = DP(:,:,i+offset); - D2Tij = D2T(:,:,i,j); - D2Omij = D2Om(:,:,i,j); + for i=1:j+offset, + DTi = DT(:,:,i); + DPi = DP(:,:,i); + D2Tij = D2T(:,:,i,j+offset); + D2Omij = D2Om(:,:,i,j+offset); tmp = D2Tij*Pstar*T' + T*Pstar*D2Tij' + DTi*DPj*T' + DTj*DPi*T' + T*DPj*DTi' + T*DPi*DTj' + DTi*Pstar*DTj' + DTj*Pstar*DTi' + D2Omij; dum = lyapunov_symm(T,tmp,DynareOptions.qz_criterium,DynareOptions.lyapunov_complex_threshold); dum(abs(dum)<1.e-12) = 0; - D2P(:,:,i+offset,j+offset) = dum; - D2P(:,:,j+offset,i+offset) = dum; + D2P(:,:,i,j+offset) = dum; + D2P(:,:,j+offset,i) = dum; end end end