# Deterministic and stochastic shocks in the same model

**URL:** <https://forum.dynare.org/t/deterministic-and-stochastic-shocks-in-the-same-model/17768>\
**Category:** Perfect foresight simulations\
**Created:** [31 March 2021 11:27 UTC](https://forum.dynare.org/t/deterministic-and-stochastic-shocks-in-the-same-model/17768 "2021-03-31T11:27:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![veronica\_acurio\_v](https://forum.dynare.org/letter_avatar_proxy/v4/letter/v/a9a28c/32.png) [@veronica\_acurio\_v](https://forum.dynare.org/u/veronica_acurio_v)\
**Post date:** [31 March 2021 11:27 UTC](https://forum.dynare.org/t/deterministic-and-stochastic-shocks-in-the-same-model/17768/1 "2021-03-31T11:27:30Z")

</div>

Dear Johannes,

Is there a way to have stochastic shocks together with deterministic shocks in the same model?

I have read the code for RBC\_news\_shock\_model.mod, which seems to be able to do that, however I have some questions:

1. By defining  
z=rhoz\*z(-1)+eps\_z\_surprise + eps\_z\_news(-8);

shocks;  
var eps\_z\_news=1; //8 period anticipated TFP news shock  
var eps\_z\_surprise=1; //TFP surprise shock  
end;

you’re assuming that both shocks are stochastic after period 8, right?

Then having eps\_z\_news(-8) makes this part of the shock deterministic (then known)?

1. In the second part, with

shock\_matrix(1,strmatch(‘eps\_z\_news’,M\_.exo\_names,‘exact’)) = 1;  
shock\_matrix(1+8,strmatch(‘eps\_z\_surprise’,M\_.exo\_names,‘exact’)) = -1;

you are assuming that the deterministic shock only hits in period 1, then in period 9 the stochastic hits with value -1.

If I wanted to assume that the deterministic shock is 1 in each period from 1 to 8, then I should simply do this

shock\_matrix(2,strmatch(‘eps\_z\_news’,M\_.exo\_names,‘exact’)) = 1;  
shock\_matrix(3,strmatch(‘eps\_z\_news’,M\_.exo\_names,‘exact’)) = 1;  
etc…

right ?

1. Let’s say I want to do the same thing but assuming that there are two different exogenous variables: one with 8 known values (z1 in the labor FOC), and the other a pure stochastic (z2 in the production function).

exp(z1)\*psi\*exp(c)^{sigma}\*1/(1-exp(l))=exp(w);  
exp(y)=exp(z2)\*exp(k(-1))^{alpha}\*exp(l)^{(1-alpha)};

z1=rhoz1\*z1(-1)+eps\_z1;  
z2=eps\_z2;

shocks;  
var eps\_z1=1; //8 period anticipated labor supply shock  
var eps\_z2=1; //TFP surprise TFP shock  
end;

This code should work and assume that z1 shock is deterministic until period 8, after period 8, this becomes a stochastic shock without persistance, while z2 is stochastic from period 0 and persistant with rhoz1 right?

Thanks for your answer!

Verónica

---

<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:** [31 March 2021 15:23 UTC](https://forum.dynare.org/t/deterministic-and-stochastic-shocks-in-the-same-model/17768/2 "2021-03-31T15:23:59Z")

</div>

Please have a look at [Problems with mixing shocks?](https://forum.dynare.org/t/problems-with-mixing-shocks/15027)

What exactly is the information structure you have in mind?

---

<div class="post-metadata">

**Author:** ![veronica\_acurio\_v](https://forum.dynare.org/letter_avatar_proxy/v4/letter/v/a9a28c/32.png) [@veronica\_acurio\_v](https://forum.dynare.org/u/veronica_acurio_v)\
**Post date:** [31 March 2021 15:35 UTC](https://forum.dynare.org/t/deterministic-and-stochastic-shocks-in-the-same-model/17768/3 "2021-03-31T15:35:49Z")

</div>

Will do thanks.

What do you mean by “information structure”?

---

<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:** [1 April 2021 06:51 UTC](https://forum.dynare.org/t/deterministic-and-stochastic-shocks-in-the-same-model/17768/4 "2021-04-01T06:51:02Z")

</div>

When are agents supposed to know what happens? Do they know the actual values and persistence? Or only the distribution? Are they supposed to react to potentially stochastic shocks via e.g. precautionary behavior? Or is certainty equivalence OK.

---

<div class="post-metadata">

**Author:** ![veronica\_acurio\_v](https://forum.dynare.org/letter_avatar_proxy/v4/letter/v/a9a28c/32.png) [@veronica\_acurio\_v](https://forum.dynare.org/u/veronica_acurio_v)\
**Post date:** [1 April 2021 07:29 UTC](https://forum.dynare.org/t/deterministic-and-stochastic-shocks-in-the-same-model/17768/5 "2021-04-01T07:29:33Z")

</div>

Agents are suppose to know the actual values for one of the shocks (z1) until period 8, but they only know persistance and distribution of the other (z2).

So knowing the exact value of occurence of z1, agents are supposed to react to potentially stochastic shocks z2.

---

<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:** [2 April 2021 13:34 UTC](https://forum.dynare.org/t/deterministic-and-stochastic-shocks-in-the-same-model/17768/6 "2021-04-02T13:34:27Z")

</div>

But what happens with `z1` after period 8? It becomes 0 forever and agents know that as well?

---

<div class="post-metadata">

**Author:** ![veronica\_acurio\_v](https://forum.dynare.org/letter_avatar_proxy/v4/letter/v/a9a28c/32.png) [@veronica\_acurio\_v](https://forum.dynare.org/u/veronica_acurio_v)\
**Post date:** [12 April 2021 06:10 UTC](https://forum.dynare.org/t/deterministic-and-stochastic-shocks-in-the-same-model/17768/7 "2021-04-12T06:10:10Z")

</div>

That was part of my first question. I would like to know if the formulation I propose translates that after the 8 period the shock become stochastic or in the contrary that it becomes 0 forever deterministic.

---

<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:** [28 April 2021 08:49 UTC](https://forum.dynare.org/t/deterministic-and-stochastic-shocks-in-the-same-model/17768/8 "2021-04-28T08:49:10Z")

</div>

Under certainty equivalence (order=1), that distinction is not really meaningful. Stochastic shocks can happen all the time, but the distribution does not affect the decision rules.
