# Steady-state error in "Fimod"

**URL:** <https://forum.dynare.org/t/steady-state-error-in-fimod/4384>\
**Category:** Dynare help (legacy posts)\
**Created:** [2 January 2015 00:31 UTC](https://forum.dynare.org/t/steady-state-error-in-fimod/4384 "2015-01-02T00:31:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![cesare\_00](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/8797f3/32.png) [@cesare\_00](https://forum.dynare.org/u/cesare_00)\
**Post date:** [2 January 2015 00:31 UTC](https://forum.dynare.org/t/steady-state-error-in-fimod/4384/1 "2015-01-02T00:31:19Z")

</div>

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](https://forum.dynare.org/uploads/default/original/2X/f/f57514f473ebcac6a1078895e36294bb3fdf336f.mod) (45.8 KB)  
[StahlerThomas\_EMappendix\_2012.pdf](https://forum.dynare.org/uploads/default/original/2X/c/cdb658d756253ee3e9f8f2b38857126c308bb9ab.pdf) (129 KB)  
[StahlerThomas\_EM\_2012.pdf](https://forum.dynare.org/uploads/default/original/2X/e/e18c44bcd57ae4589a8b0813c3fecec3fdc7a1c0.pdf) (920 KB)

---

<div class="post-metadata">

**Author:** ![cesare\_00](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/8797f3/32.png) [@cesare\_00](https://forum.dynare.org/u/cesare_00)\
**Post date:** [3 January 2015 16:27 UTC](https://forum.dynare.org/t/steady-state-error-in-fimod/4384/2 "2015-01-03T16:27:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [5 January 2015 22:05 UTC](https://forum.dynare.org/t/steady-state-error-in-fimod/4384/3 "2015-01-05T22:05:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cesare\_00](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/8797f3/32.png) [@cesare\_00](https://forum.dynare.org/u/cesare_00)\
**Post date:** [12 January 2015 12:12 UTC](https://forum.dynare.org/t/steady-state-error-in-fimod/4384/4 "2015-01-12T12:12:06Z")

</div>

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](https://forum.dynare.org/uploads/default/original/2X/0/013d0344495dddf5096bd700076ebe33d715e2bc.mod) (48.9 KB)  
[Fimod.mod](https://forum.dynare.org/uploads/default/original/2X/3/32475d5a677b481bf740e51c07149b3061307f11.mod) (48.8 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [12 January 2015 20:02 UTC](https://forum.dynare.org/t/steady-state-error-in-fimod/4384/5 "2015-01-12T20:02:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![cesare\_00](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/8797f3/32.png) [@cesare\_00](https://forum.dynare.org/u/cesare_00)\
**Post date:** [13 January 2015 15:42 UTC](https://forum.dynare.org/t/steady-state-error-in-fimod/4384/6 "2015-01-13T15:42:04Z")

</div>

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](https://forum.dynare.org/uploads/default/original/2X/9/91c8d995b81bad08d969c7ec1f1c3a64caa401d9.mod) (50.1 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [15 January 2015 08:35 UTC](https://forum.dynare.org/t/steady-state-error-in-fimod/4384/7 "2015-01-15T08:35:49Z")

</div>

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

```auto

```

instead of

```auto

```

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.

---

<div class="post-metadata">

**Author:** ![cesare\_00](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/8797f3/32.png) [@cesare\_00](https://forum.dynare.org/u/cesare_00)\
**Post date:** [15 January 2015 22:11 UTC](https://forum.dynare.org/t/steady-state-error-in-fimod/4384/8 "2015-01-15T22:11:59Z")

</div>

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)  
sim1;

Error in Fimod (line 3050)  
simul();

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](https://forum.dynare.org/uploads/default/original/2X/1/1275f259b42aa3a43a6c8b7199f3071801b8001e.mod) (52.3 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [17 January 2015 15:39 UTC](https://forum.dynare.org/t/steady-state-error-in-fimod/4384/9 "2015-01-17T15:39:44Z")

</div>

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?
