From 8aef28d28806acc71cf10da4e81d57ba015b9cf8 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Wed, 14 Nov 2018 08:19:12 +0100
Subject: [PATCH] Correctly update covariance matrix of shocks for posterior
 draws

(cherry picked from commit b333f6bf2b30938fde3a635555fc57083b21693a)
---
 matlab/dsge_simulated_theoretical_correlation.m            | 1 +
 matlab/dsge_simulated_theoretical_covariance.m             | 1 +
 matlab/dsge_simulated_theoretical_variance_decomposition.m | 1 +
 3 files changed, 3 insertions(+)

diff --git a/matlab/dsge_simulated_theoretical_correlation.m b/matlab/dsge_simulated_theoretical_correlation.m
index dca1031661..7bc6239c5e 100644
--- a/matlab/dsge_simulated_theoretical_correlation.m
+++ b/matlab/dsge_simulated_theoretical_correlation.m
@@ -104,6 +104,7 @@ for file = 1:NumberOfDrawsFiles
     for linee = 1:NumberOfDraws
         linea = linea+1;
         if isdrsaved
+            M_=set_parameters_locally(M_,pdraws{linee,1});% Needed to update the covariance matrix of the state innovations.
             dr = pdraws{linee,2};
         else
             M_=set_parameters_locally(M_,pdraws{linee,1});
diff --git a/matlab/dsge_simulated_theoretical_covariance.m b/matlab/dsge_simulated_theoretical_covariance.m
index 19f56297fa..e5dfd58e88 100644
--- a/matlab/dsge_simulated_theoretical_covariance.m
+++ b/matlab/dsge_simulated_theoretical_covariance.m
@@ -103,6 +103,7 @@ for file = 1:NumberOfDrawsFiles
     for linee = 1:NumberOfDraws
         linea = linea+1;
         if isdrsaved
+            M_=set_parameters_locally(M_,pdraws{linee,1});% Needed to update the covariance matrix of the state innovations.
             dr = pdraws{linee,2};
         else
             M_=set_parameters_locally(M_,pdraws{linee,1});
diff --git a/matlab/dsge_simulated_theoretical_variance_decomposition.m b/matlab/dsge_simulated_theoretical_variance_decomposition.m
index c1c6d62077..6dc7c709f0 100644
--- a/matlab/dsge_simulated_theoretical_variance_decomposition.m
+++ b/matlab/dsge_simulated_theoretical_variance_decomposition.m
@@ -111,6 +111,7 @@ for file = 1:NumberOfDrawsFiles
     for linee = 1:NumberOfDraws
         linea = linea+1;
         if isdrsaved
+            M_=set_parameters_locally(M_,pdraws{linee,1});% Needed to update the covariance matrix of the state innovations.
             dr = pdraws{linee,2};
         else
             M_=set_parameters_locally(M_,pdraws{linee,1});
-- 
GitLab