From dde7f1fe455da91101cf6f3f1820e2d95290f54a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Sedna=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Fri, 13 May 2011 14:34:53 +0200
Subject: [PATCH] Bug fix related to cova_compute==0 (The reported posterior
 mode was the prior mode in this case). (cherry picked from commit
 26a4a011d085e8b1443673d4c71f8b84bdc43cf9)

---
 matlab/dynare_estimation_1.m | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/matlab/dynare_estimation_1.m b/matlab/dynare_estimation_1.m
index b821aeb93a..9f0e890bf7 100644
--- a/matlab/dynare_estimation_1.m
+++ b/matlab/dynare_estimation_1.m
@@ -445,9 +445,11 @@ if options_.mode_check == 1 && ~options_.mh_posterior_mode_estimation && options
     end
 end
 
-if ~options_.mh_posterior_mode_estimation && options_.cova_compute
-    invhess = inv(hh);
-    stdh = sqrt(diag(invhess));
+if ~options_.mh_posterior_mode_estimation
+    if options_.cova_compute
+        invhess = inv(hh);
+        stdh = sqrt(diag(invhess));
+    end
 else
     variances = bayestopt_.p2.*bayestopt_.p2;
     idInf = isinf(variances);
-- 
GitLab