Permanent Shock in deterministic model



I am struggling to set up an permanent shock to simulate a steady state transition in my model.
As suggested I have used initval and endval.

Everything is running without problems except that the shock is not really permanent.

By checking the simulated variables, the zshock variable looks like this:

Period Value
1 0.3446
2 0.3101
3 0.3101

300 0.3101
301 0.3101
302 0.3446

Why is it going back to the initial value in 302, which leads the model back to the old steady state?

Does anyone have an idea how to fix this?

Best regards


I cannot replicate the issue in Dynare 4.5.5.


Hello Professor Pfeifer,

I am using 4.5.5 as well and I downloaded my own files again to run them but the problem still exists.

To ensure that we talk about the some thing I have uploaded a screenshot of the simulated variable.

Can you confirm that this is not the case when you run the code?
I will try to run the code on a different computer soon.

Thank you for your help.


I see. You can verify in oo_.exo_simul that the exogenous variable you set is correctly set. The variable you are talking about an endogenous variable (‘z_shock’). It’s value for periods 2 to 301 are solved for given the terminal condition you provided in endval and the initial condition provided via initval. In the endval-block you did not set z_shock, which explains your picture above. That being said, given that z_shock is not forward-looking, the value in the last period does not matter.


But if you simulate the model for lets say 1000 periods you can see in oo_.endo_simul that the varibales have converged to the new steady state after 200 periods.
However, in the end at period 1002 the model is back in the steady state of period 1.

So if it is not z_shock what causes this then? I want the model to stay in this new steady state forever.


That is only true if your model does not feature forward-looking variables. You did not instruct the code to end in the terminal steady state. For that to be the case, you need to set not only the exogenous variables, but also the other variables. As documented, you need to put steady after endval-block. However, your steady_state file is not correct. You set
but that is not correct. The model equation is
so the file must work for any value of epsilon provided in the input exo to the steady state file.


Thank you very much. I understood the problem now and it works when I declare all variables in initval and endval.

But how does this work with the steady state file? How do I tell dynare to use two different epsilon in the steady state file?


The header of your steady state file is

function [ys,check] = Version9_3_steadystate(ys,exo)

exo here stores the value of epsilon. Thus, your file should compute the steady state conditional on this function input.


I finally got it.

Thank you!