Perfect Foresight Simulation in a DMP-SIR model

I have been working on an integration of SIR model transitions into a DMP search-and-matching framework to assess and compare COVID labour market outcomes between countries. For this purpose, I have extended both firm decision and the worker value functions to infection and recovery dynamics (I attach a quick overview of this extension).
I have successfully solved for the pre-covid steady state and am now attempting to introduce shocks to the infection rate (which increases form 0) and to the separation rate (which increased during COVID times). This one time shock allows for the transition to a COVID steady state.
However, dynare does not seem to be able to find a steady state, even though I state as initial values the pre-COVID steady state I calculate before.
Could you help me solve this issue?
DMP-SIR.pdf (91.9 KB)
dyn_pre.mod (743 Bytes)
dyn_cov.mod (2.6 KB)

Typically, the new steady-state is an endogenous function of the infection dynamics, so it is not surprising at all that you are not able to calculate it. However, for perfect foresight simulations we only need values at the terminal steady-state for the forward looking variables only. So one way out is to replace all forward looking variables by an auxiliary variable that has always a constant steady-state, i.e. either in growth-rates or differences. Dynare has a neat option differentiate_forward_vars which you can use.

You might want to look into my lecture notes, where I cover several numerical issues that one faces in a New Keynesian SIR model (this basically replicates the JEDC paper of Eichenbaum, Rebelo and Trabandt.):
week_6.pdf (382.2 KB)

The Newton algorithm requires the evaluation of the forward-looking variables at the terminal steady-state. But the terminal steady-state is an endogenous function of the epidemic dynamics; hence, it is not known a priori. Typically, this makes the perfect foresight solution algorithm inaccurate and often the solution cannot not found. But notice that the problem is just that we need to evaluate ONLY the forward-looking variables. So, one way out is to replace all forward-looking variables in the model by auxiliary variables that have a known terminal steady-state, such that the solution regains numerical accuracy.
Dynare’s differentiate_forward_vars option implements the following transformation automatically:
Replace all (or a subset of) variables dated t+1, say X_{t+1}, by the sum of the current level and expected variation, X_t + dX_{t+1}, and introduce an auxiliary equation for the new variable dX_t=X_t-X_{t-1}. This transformation is done automatically by Dynare’s preprocessor,which is a very good thing because doing such transformations manually is extremely error-prone.

You can find the codes in this GitHub repo.

Thank you for the prompt reply!
I am sorry if my question seems repetitive, I am quite new to the dynare setup.
I have attempted your proposed solution, replacing “model;” by “model(differentiate_forward_vars);”. The result is unchanged, I am unsure whether I missed a step.
I read through your lecture notes and attempted to change some additional features but was unsuccessful.
dyn_cov.mod (2.7 KB)

The problem is that your computed steady state for the simple model does not fit for the more complicated one. Have a look at the residuals. The biggest issue is that the Js are interdependent.

Thank you for the reply. Yes, I noticed that issue but am unsure of how to proceed to generate the desired steady state transition. What would you suggest?

Computing the steady state manually. That should be doable. Or reduce your problem to a smaller system that you can solve numerically.

Thank you for your prompt replies.
I set the infection, recovery, and death rates to 0 as well as revert the separation rate to its pre-pandemic long-term average. This simplifies the system of equations to a pre-pandemic setup matching that of the simple model (only extending somewhat the number of equations).
My errors have reduced, but are still not 0. Is there any other method I could try?
Thank you once again!
dyn_cov.mod (2.8 KB)
dyn_pre.mod (743 Bytes)

Sorry, but I still don’t understand. The problem at the moment is computing the initial steady state, not the terminal one. For some reason, the initial steady of the pre-pandemic setup is not a steady state of the full model before the pandemic starts.