NAN Error Deterministic Simulation Non-Linear Model

Hi everyone,

I am working on a simple model with migration. The stochastic simulation works fine but for the non-linear model, the deterministic simulation does not converge even with a temporary shock to productivity.

To work around this issue, I log-linearized model by hand and used that for the deterministic simulation and it works fine for temporary shocks. I would prefer to get the non-linear model working because I want to look at transition dynamics after a permanent change in some model parameters which is less convenient to do (if I understand correctly) w/ a log-linearized model since it is linearized around the initial ss.

Additional note: In the investment decision, I am aware of the dynare timing convention, and the investment decision is purposely written differently here which is most closely related to Mandelman and Zlate (2012): … 6-213.html

Please find .mod files for both attached.

Thank you for your help!
lin.mod (5.31 KB)
nonlin_deterministic.mod (8.24 KB)