C++ Runtime error - 3rd order app

Hi Johannes,

Thank you again. I will keep a track of the link for updates.

After I reported this, I tried working on it. For now I have been able to resolve the problem, however it will be great if you can review what I am doing is correct. I followed these steps:

  1. I captured the value of the parameters where the error was occurring.
  2. I ran the mod file standalone, i.e. using the steady, check commands and not resol as in obj fn.
  3. In the toy example I reported and other models I am working on, the parameter values gave either of these errors:
  • Steady state is complex, or
  • Jacobian is Nan, or
  • One of the eigenvalues is close to 0/0 …

This seems to be related to use of options_.k_order_solver=1 (as discussed in the Estimation of Third-order model). When using resol.m in obj fn, after enabling options_.k_order_solver=1 it always call k_order_pert.m (from stochastic_solver.m). However, if a set of parameter values does not generate valid SS, Jacobian or eigenvalues k_order_pert causes the crash.
When using standalone mod file, dynare uses the check where it doesn’t set options_.k_order_solver=1 and k_order_pert.m isn’t called. For an invalid parameter set, dynare throws an error and stops.

So, instead of using this part of code (checking for info) after resol in obj fn.
if info ~= 0
obj = 10e+6;
return
end

I call check:
options_.k_order_solver=0;
[info] = checkD(M_, options_, oo_);
if info~=0
obj = 10e+6;
disp(‘Check failed’);
return
end

Then use options_.k_order_solver=1; and call resol.
This has helped in resolving the issue. Hopefully this helps in clarifying the problem more. Please let me know if this is fine.

Thank you again.