From 871fa6aa86c5a87c3203435d5e384b27bb90d80d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Fri, 18 Jul 2014 18:36:02 +0200
Subject: [PATCH] Issue a warning if conditional forecasts are computed with
 correlated innovations (if these correlations are defined in the covariance
 matrix of the innovations).

---
 matlab/imcforecast.m | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/matlab/imcforecast.m b/matlab/imcforecast.m
index d32999914..17587ade1 100644
--- a/matlab/imcforecast.m
+++ b/matlab/imcforecast.m
@@ -45,7 +45,6 @@ function imcforecast(constrained_paths, constrained_vars, options_cond_fcst)
 
 global options_ oo_ M_ bayestopt_
 
-
 if ~isfield(options_cond_fcst,'parameter_set') || isempty(options_cond_fcst.parameter_set)
     options_cond_fcst.parameter_set = 'posterior_mode';
 end
@@ -127,8 +126,13 @@ end
 if isempty(options_.qz_criterium)
     options_.qz_criterium = 1+1e-6;
 end
+
 [T,R,ys,info,M_,options_,oo_] = dynare_resolve(M_,options_,oo_);
 
+if ~isdiagonal(M_.Sigma_e)
+    warning(sprintf('The innovations are correlated (the covariance matrix has non zero off diagonal elements), the results of the conditional forecasts will\ndepend on the ordering of the innovations (as declared after varexo) because a Cholesky decomposition is used to factorize the covariance matrix.\n\n=> It is preferable to declare the correlations in the model block (explicitly imposing the identification restrictions), unless you are satisfied\nwith the implicit identification restrictions implied by the Cholesky decomposition.'))
+end
+
 sQ = chol(M_.Sigma_e,'lower');
 
 NumberOfStates = length(InitState);
-- 
GitLab