diff --git a/matlab/cli/prior.m b/matlab/cli/prior.m index 5c48fcebcc5c0d2138d675043155af806d89ef7d..9e044506646b29224efcada72ef6969ce8af48c1 100644 --- a/matlab/cli/prior.m +++ b/matlab/cli/prior.m @@ -128,6 +128,12 @@ if ismember('moments', varargin) % Prior simulations (2nd order moments). oo__.dr = set_state_space(oo__.dr, Model, options_); % Solve model [dr, info, Model , options__ , oo__] = resol(0, Model , options_ ,oo__); + if info + skipline() + disp(sprintf('Cannot solve the model on the prior mode (info = %s, %s)', num2str(info(1)), interpret_resol_info(info))); + skipline() + return + end % Compute and display second order moments oo__ = disp_th_moments(oo__.dr, [], Model, options__, oo__); skipline(2) diff --git a/matlab/interpret_resol_info.m b/matlab/interpret_resol_info.m new file mode 100644 index 0000000000000000000000000000000000000000..de16d47e093ffba38e9b35740a705bac521ff205 --- /dev/null +++ b/matlab/interpret_resol_info.m @@ -0,0 +1,60 @@ +function message = interpret_resol_info(info) + +% Returns a message describing problem encountered during the resolution of +% a model. +% +% INPUTS +% - info [struct] Second output argument return by the resol routine +% +% OUTPUTS +% - message [string] Description of the issue preventing model's resolution. + +% Copyright (C) 2001-2016 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <http://www.gnu.org/licenses/>. + +switch info(1) + case 0 + message = ''; + case 1 + message = 'The model doesn''t determine the current variable uniquely.'; + case 2 + message = 'MJDGGES (Generalized Schur decomposition) returned an error code.'; + case 3 + message = 'Blanchard & Kahn conditions are not satisfied: no stable equilibrium.'; + case 4 + message = 'Blanchard & Kahn conditions are not satisfied: indeterminacy.'; + case 5 + message = 'Blanchard & Kahn conditions are not satisfied: indeterminacy due to rank failure.'; + case 6 + message = 'The jacobian evaluated at the deterministic steady state is complex.'; + case 19 + message = 'The steadystate routine thrown an exception (inconsistent deep parameters).'; + case 20 + message = sprintf('Cannot find the steady state (the sum of square residuals of the static equations is %s)', num2str(info(2))); + case 21 + message = sprintf('The steady state is complex (the sum of square residuals of imaginary parts of the steady state is %s)', num2str(info(2))); + case 22 + message = 'The steady state has NaNs.'; + case 23 + message = 'Parameters have been updated in the steadystate routine and some have complex values.'; + case 24 + message = 'Parameters have been updated in the steadystate routine and some are NaNs.'; + case 30 + message = 'Ergodic variance can''t be computed.'; + otherwise + message = 'Unknown issue!'; +end \ No newline at end of file