From 9118c7ac4cc6b2bd3ef0e711f92529fd9a38fd0c Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer <jpfeifer@gmx.de> Date: Wed, 2 Oct 2024 19:32:06 +0200 Subject: [PATCH] ep: filter out non-positive definite covariance matrices --- matlab/ep/setup_stochastic_perfect_foresight_model_solver.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/matlab/ep/setup_stochastic_perfect_foresight_model_solver.m b/matlab/ep/setup_stochastic_perfect_foresight_model_solver.m index 360f7a6928..5266a1b4f0 100644 --- a/matlab/ep/setup_stochastic_perfect_foresight_model_solver.m +++ b/matlab/ep/setup_stochastic_perfect_foresight_model_solver.m @@ -27,6 +27,10 @@ pfm.ny = M_.endo_nbr; pfm.Sigma = M_.Sigma_e; if det(pfm.Sigma) > 0 pfm.Omega = chol(pfm.Sigma,'upper'); % Sigma = Omega'*Omega +else + if options_.ep.stochastic.order>0 + error('setup_stochastic_perfect_foresight_model_solver:: the covariance matrix of shocks must be positive definite when using stochastic extended path') + end end pfm.number_of_shocks = length(pfm.Sigma); pfm.stochastic_order = options_.ep.stochastic.order; -- GitLab