From e1a0fd05240ea86ac1f7531f9e23d02a82631b1f Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Tue, 3 Sep 2013 16:22:39 +0200 Subject: [PATCH 1/2] Bugfix for conditional variance decomposition sigma_e_is_diagonal was erroneously set to 0 if the covariance matrix was diagonal, but contained a 0 on the main diagonal. --- matlab/dynare_estimation_1.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matlab/dynare_estimation_1.m b/matlab/dynare_estimation_1.m index 381e1a794..dc4f8490d 100644 --- a/matlab/dynare_estimation_1.m +++ b/matlab/dynare_estimation_1.m @@ -82,7 +82,7 @@ end % Set sigma_e_is_diagonal flag (needed if the shocks block is not declared in the mod file). M_.sigma_e_is_diagonal = 1; -if estim_params_.ncx || ~isequal(nnz(M_.Sigma_e),length(M_.Sigma_e)) +if estim_params_.ncx || any(nnz(tril(M_.Sigma_e,-1))) M_.sigma_e_is_diagonal = 0; end From c2e6feeb75557cc44e25f68df644f5be81fca1a7 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Tue, 3 Sep 2013 16:23:24 +0200 Subject: [PATCH 2/2] Deletion of unused definition of H_is_diagonal Cosmetic fix --- matlab/dynare_estimation_1.m | 5 ----- 1 file changed, 5 deletions(-) diff --git a/matlab/dynare_estimation_1.m b/matlab/dynare_estimation_1.m index dc4f8490d..f3fb2b76c 100644 --- a/matlab/dynare_estimation_1.m +++ b/matlab/dynare_estimation_1.m @@ -99,11 +99,6 @@ if ~isequal(estim_params_.ncx,nnz(tril(M_.Sigma_e,-1))) end end -M_.H_is_diagonal = 1; -if estim_params_.ncn || ~isequal(nnz(M_.H),length(M_.H)) - M_.H_is_diagonal = 0; -end - % Set the correlation matrix of measurement errors if necessary. if ~isequal(estim_params_.ncn,nnz(tril(M_.H,-1))) M_.Correlation_matrix_ME = diag(1./sqrt(diag(M_.H)))*M_.H*diag(1./sqrt(diag(M_.H)));