irf_matching: add message for explosive irfs to get_error_message

covariance-quadratic-approximation
Willi Mutschler 2023-12-13 21:43:13 +01:00
parent 0b839467e6
commit 9148b5b210
No known key found for this signature in database
GPG Key ID: 91E724BF17A73F6D
2 changed files with 6 additions and 3 deletions

View File

@ -270,14 +270,15 @@ if strcmp(options_mom_.mom.mom_method,'IRF_MATCHING') && strcmp(options_mom_.mom
y_irf = irf(M_, options_mom_, dr, cs(:,i), options_mom_.irf, options_mom_.drop, options_mom_.replic, options_mom_.order);
end
if any(any(isnan(y_irf))) && ~options_mom_.pruning && ~(options_mom_.order==1)
fprintf('\nirf_matching: The simulations conducted for generating IRFs to %s were explosive: Either reduce the shock size, use pruning, or set the approximation order to 1.\n', M_.exo_names{i})
fval = Inf;
info(1) = 180;
info(1) = 181;
info(4) = 0.1;
fval = Inf;
exit_flag = 0;
if options_mom_.mom.vector_output == 1 % lsqnonlin requires vector output
fval = ones(options_mom_.mom.mom_nbr,1)*options_mom_.huge_number;
end
message = get_error_message(info,options_mom_);
fprintf('\n%s\n info = %d for shock %s.\n', message, info(1), M_.exo_names{i});
return
end
if options_mom_.relative_irf

View File

@ -168,6 +168,8 @@ switch info(1)
message = 'Aim: Problem in SPEIG.';
case 180
message = 'SMM: simulation resulted in NaN/Inf. You may need to enable pruning.';
case 181
message = 'IRF Matching: simulated IRFs were explosive. Either reduce the shock size, use pruning, or set the approximation order to 1.';
case 201
message = 'Particle Filter: Initial covariance of the states is not positive definite. Try a different nonlinear_filter_initialization';
case 202