Steady-state error in "Fimod"

Hello everybody,
I’m trying to write the dynare code for “Fimod- a DSGE model for fiscal policy simulation”, but I’m stuck with a steady state value error. Specifically, I can’t get the residual of the static equations #181 and #182 (same denomination in my mod file) straight. I’ve attached the paper, my mod file and the mathematical Appendix of the paper where you can find a summary of all the equations with the related steady state calculations, which I have followed to write down the code. After days of debugging, I’m not able to see what’s wrong, that’s why I’m asking for help. I don’t know if I’m missing something, or if there is an error in the appendix, since i have already found few of them. Thank you very much, useless to say any help would be very much appreciated.
Fimod.mod (45.8 KB)
StahlerThomas_EMappendix_2012.pdf (129 KB)
StahlerThomas_EM_2012.pdf (920 KB)

Ok, i figured it out. There were a few errors in the mathematical appendix of the paper, i fixed them and now it works. Thanks

Could you provide other users with the new file or give an indication what the issues were?

Here is the final mod.file for Fimod (“Fimod.mod”). I have another question though; I’m trying to replicate the IRFs of the paper relatives to a permanent reduction in home government purchases. As the manual suggests, I’ve added a unit root process(at the end of the model block) for the error of Government purchases (e_Cg in my code) and simulted a shock for the new error(eps_Cg). Everything seems fine in the code, but i get NaN theoretical moments and the “All endogenous are constant or non stationary…” error. I don’t really know where to look for fix this problem, can you help? Thanks a lot, the code with the permanent reduction in government purchases is “Fimod1.mod”.
Fimod1.mod (48.9 KB)
Fimod.mod (48.8 KB)

There is no way to fix this. Having a unit root implies that some unconditional moments simply do not exist. You can generate IRFs, but you cannot compute unconditional moments.

Fair enough, many thanks! I have two more questions:

1 - If I try to make the shock for C_g to last more than one period (using command “periods 1:4” in the shocks block), i don’t get any Irfs( I checked the reference manual about this, even if use the command “varexo_det” at the beginning of my .mod file, nothing changes, i still don’t get any plot or oo_.irfs file). What am I doing wrong?

2 - my final goal is to replicate the irfs from Fig.1 in the paper attached in my earlier post. My understanding is they simulate a permanent reduction in government purchase(C_g) at the beginning of the fourth year, i.e. after 16 quarters. I added a unit root process for C_g and I’m guessing the only way to perform this reduction is to impose a shock in period 16 for the error of the unit root process till period 17. But, as before, i don’t get any irfs. I know it sounds a bit tricky, so it’s possible I haven’t understood what the two authors really do, but i don’t see any other explanation.

the .mod file attached is the one relative to question n 1.Any idea how to replicate authors’ irfs?
Last time i bother, promise.
Thanks a lot again for your precious help
Fimod1.mod (50.1 KB)

I found the time to have a quick look at the paper. They are not doing stochastic IRFs, but rather deterministic simulations, i.e. studying the transition from one steady state to another.

This means you should use

instead of

Specifying shocks for certain periods as you currently do is not compatible with stoch_simul. By treating the variables that change directly as exogenous (as opposed to having a unit root process with a separate shock), it should be straightforward to get the desired responses.

Professor, Thanks for your help and your time! I’m doing what you told me, in simulating a permanent increase in labour tax(t_w) i took out of the model the stochastic process driving t_w and considered it as an exogenous variable. I added the “endval” block, the shock which starts in the 4th year and used the command simul as you said. But i keep having the following error, no matter what:

Error using sim1 (line 144)
Simulation terminated with NaN or Inf in the residuals or
endogenous variables. There is most likely something wrong
with your model.

Error in simul (line 126)

Error in Fimod (line 3050)

Error in dynare (line 182)
evalin(‘base’,fname) ;

Do you think it has something to do with the equation for t_w i took out?
I really don’t know how to thank you anymore
Fimod.mod (52.3 KB)

The setup for the simulations seems correct, but your model has problems. Have you noticed that k_o (private capital) has a negative steady state?