From e91f0776f2a07d1ea3f12f3f4523f8bbc7c26d4f Mon Sep 17 00:00:00 2001 From: Michel Juillard Date: Tue, 5 Apr 2011 13:46:58 +0200 Subject: [PATCH] discretionary policy: made returned info values compatible with Dynare --- matlab/discretionary_policy_engine.m | 10 +++++----- matlab/print_info.m | 11 ++++++++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/matlab/discretionary_policy_engine.m b/matlab/discretionary_policy_engine.m index 864ea377f..67aef9f23 100644 --- a/matlab/discretionary_policy_engine.m +++ b/matlab/discretionary_policy_engine.m @@ -95,24 +95,24 @@ while 1 H10=H1; F10=F1; end -retcode=rcode-1; -switch retcode +retcode = 0; +switch rcode case 3 % nan - retcode=3; + retcode=63; retcode(2)=10000; if verbose disp([mfilename,':: NAN elements in the solution']) end case 2% maxiter - retcode = 1 + retcode = 61 if verbose disp([mfilename,':: Maximum Number of Iterations reached']) end case 1 BadEig=max(abs(eig(H1)))>qz_criterium; if BadEig - retcode=3; + retcode=62; retcode(2)=100*max(abs(eig(H1))); if verbose disp([mfilename,':: Some eigenvalues greater than qz_criterium, Model potentially unstable']) diff --git a/matlab/print_info.m b/matlab/print_info.m index 7c1a3bd16..497419890 100644 --- a/matlab/print_info.m +++ b/matlab/print_info.m @@ -68,7 +68,16 @@ if ~noprint error('You are estimating a DSGE-VAR model, but the value of the dsge prior weight is too low!') case 52 %DsgeVarLikelihood error(''); - + case 61 %Discretionary policy + error(['Discretionary policy: maximum number of iterations has ' ... + 'been reached. Procedure failed. ']); + case 62 + error(['Discretionary policy: some eigenvalues greater than ' ... + 'options_.qz_criterium. Model potentially unstable.']); + case 63 + error(['Discretionary policy: NaN elements are present in the ' ... + 'solution. Procedure failed.']); + % Aim Code Conversions by convertAimCodeToInfo.m case 102 error('Aim: roots not correctly computed by real_schur.');