# State dependent impulse response functions

**URL:** <https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436>\
**Category:** Stochastic simulations\
**Created:** [8 October 2013 08:44 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436 "2013-10-08T08:44:26Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Bendel](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/ecc23a/32.png) [@Daniel\_Bendel](https://forum.dynare.org/u/Daniel_Bendel)\
**Post date:** [8 October 2013 08:44 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/1 "2013-10-08T08:44:26Z")

</div>

Hey all,

once again a general question:  
can dynare generate state dependent impulse response functions? To make this clearer:

Suppose one wants to investigate the effect of a government spending shock: my intuition tells me that the size of the fiscal multiplier should vary, if the economy is in a state where output is below or higher than its steady state value. How can I investigate this with dynare?

Has anyone experience with this topic?

Thank you all!  
Daniel

---

<div class="post-metadata">

**Author:** ![Niklas](https://forum.dynare.org/letter_avatar_proxy/v4/letter/n/34f0e0/32.png) [@Niklas](https://forum.dynare.org/u/Niklas)\
**Post date:** [8 October 2013 09:25 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/2 "2013-10-08T09:25:40Z")

</div>

Hello Daniel,

if the model is linear, the fiscal multiplier should be the same, no matter whether output is below or above the steady state. (In a linear model, impulse responses are state independent.)

Best,  
Niklas

---

<div class="post-metadata">

**Author:** ![Daniel\_Bendel](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/ecc23a/32.png) [@Daniel\_Bendel](https://forum.dynare.org/u/Daniel_Bendel)\
**Post date:** [8 October 2013 12:49 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/3 "2013-10-08T12:49:49Z")

</div>

But what if I do second order approximation?

---

<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:** [8 October 2013 13:54 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/4 "2013-10-08T13:54:19Z")

</div>

Then Dynare generates a generalized IRF that is state dependent. However, the GIRF is computed at the ergodic mean. We are working on a version that allows specifying the point at which the IRFs is generated, but it will still take some time.

---

<div class="post-metadata">

**Author:** ![np2333](https://forum.dynare.org/letter_avatar_proxy/v4/letter/n/9de0a6/32.png) [@np2333](https://forum.dynare.org/u/np2333)\
**Post date:** [24 July 2015 02:07 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/5 "2015-07-24T02:07:08Z")

</div>

Can i find some documentation on how GIRF is implemented in dynare and what options are available? In particular, is it possible to generate asymmetric irfs in dynare (i.e different irfs for negative and positive values for the same shock) under a second order approximation?

---

<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 July 2015 09:54 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/6 "2015-07-28T09:54:32Z")

</div>

Please see the RBC\_state\_dependent\_GIRF.mod on my homepage.

---

<div class="post-metadata">

**Author:** ![sidus87](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/b5e925/32.png) [@sidus87](https://forum.dynare.org/u/sidus87)\
**Post date:** [27 April 2016 15:40 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/7 "2016-04-27T15:40:48Z")

</div>

Dear Johannes,

I have a question concerning your code to compute the state-dependent GIRFs. In particular, concerning the GIRF conditional on being in the state with low capital, why do you use the deterministic steady state as a starting point instead of the ergodic mean? Is there any economic meaning behind this?

Thanks in advance

---

<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 May 2016 16:19 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/8 "2016-05-01T16:19:08Z")

</div>

There is no meaning behind this. The exercise simply was to compute the GIRF at capital 10% below the steady state. We could also have used 10% below the ergodic mean. This would simply be answering a different question.

---

<div class="post-metadata">

**Author:** ![ajpirzada](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/d9b06d/32.png) [@ajpirzada](https://forum.dynare.org/u/ajpirzada)\
**Post date:** [24 December 2018 23:05 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/9 "2018-12-24T23:05:27Z")

</div>

Hi,

Is there any update on this? I want to generate IRFs in response to oil-price shock at different levels of Rhat (see figure)

[Spread-eps-converted-to.pdf](https://forum.dynare.org/uploads/default/original/2X/b/bf6ffe715ea9be1ce4ed6871f3e4ad7dc226553b.pdf) (8.0 KB)

I have had a look at the following file **RBC\_state\_dependent\_GIRF.mod** but I am not sure if this is what I need…

It seems that whether capital is 10% below its steady-state or not has no effect on the starting value of other endogenous variables in the model… I want the starting value of all endogenous variables to be model-consistent with the arbitrary value of capital I choose… In other words, I want to shock the system when the system is at a certain point on the state-space consistent with capital being 10% below the steady-state.

I can imagine how to do this. I first need to workout the exact point on state-space for which capital is 10% less than steady state. I then need to use the decision rules to workout the values for remaining endogenous variables. Does this make sense?

Any help will be great.

Best,  
Ahmed

---

<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 January 2019 21:06 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/10 "2019-01-01T21:06:02Z")

</div>

Yes, the file

> [@ajpirzada](#):
>
> **RBC\_state\_dependent\_GIRF.mod**

is what you need. In the RBC model, only the state variables matter for the dynamics. So there is nothing else to set. I don’t understand what you mean with

> [@ajpirzada](#):
>
> a certain point on the state-space consistent with capital being 10% below the steady-state

A particular value for the state of capital has e.g. no bearing on the value for the state TFP.

---

<div class="post-metadata">

**Author:** ![ajpirzada](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/d9b06d/32.png) [@ajpirzada](https://forum.dynare.org/u/ajpirzada)\
**Post date:** [4 January 2019 17:06 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/11 "2019-01-04T17:06:23Z")

</div>

Thanks for getting back.

I think what is confusing me is the following: A lower ‘k’ would mean a lower ‘y’ in the model. But we are only changing the starting value of ‘k’ before doing simulations. So what is the value of ‘y’ when we shock the system? Is the value of ‘y’ lower than the steady-state value (in line with lower ‘k’)? or is it the steady-state value?

---

<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:** [6 January 2019 21:42 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/12 "2019-01-06T21:42:53Z")

</div>

Output Y is a control variable that is a function of the state capital. If you set capital to a particular value, output will be consistent with this value. This immediately follows from the policy functions. Only states matter.

---

<div class="post-metadata">

**Author:** ![ajpirzada](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/d9b06d/32.png) [@ajpirzada](https://forum.dynare.org/u/ajpirzada)\
**Post date:** [7 January 2019 19:17 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/13 "2019-01-07T19:17:43Z")

</div>

Great. I see what is happening now.

How will things change if I do this for the control variable rather than the state variable? Lets say I change ‘y’. What will happen to ‘k’ and ‘c’?

---

<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:** [8 January 2019 16:09 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/14 "2019-01-08T16:09:28Z")

</div>

Nothing will happen to control variables. The only thing that is relevant are the state variables.

---

<div class="post-metadata">

**Author:** ![ajpirzada](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/d9b06d/32.png) [@ajpirzada](https://forum.dynare.org/u/ajpirzada)\
**Post date:** [10 January 2019 17:38 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/15 "2019-01-10T17:38:49Z")

</div>

Thanks a lot. Grateful for clarifying this further

---

<div class="post-metadata">

**Author:** ![mlb](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/e79b87/32.png) [@mlb](https://forum.dynare.org/u/mlb)\
**Post date:** [24 September 2024 13:29 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/16 "2024-09-24T13:29:26Z")

</div>

Dear Professor,

I attempted to use your code to generate the state-dependent impulse response function. However, when I run the code on my computer, I encounter the following error:

Not enough input arguments.

Error in simult\_ (line 37)  
iter = size(ex\_,1);

Error in RBC\_state\_dependent\_GIRF.driver (line 269)  
y\_baseline = simult\_(starting\_point,oo\_.dr,shocks\_baseline,options\_.order);

Error in dynare (line 281)  
evalin(‘base’,[fname ‘.driver’]);

Error in state\_dependent\_analysis (line 18)  
dynare RBC\_state\_dependent\_GIRF

Could you please advise me on how to resolve this issue?

Best Regards,  
mpl

---

<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:** [24 September 2024 18:41 UTC](https://forum.dynare.org/t/state-dependent-impulse-response-functions/3436/17 "2024-09-24T18:41:03Z")

</div>

This looks like a version incompatibility. The Dynare 6 version is currently [DSGE\_mod/RBC\_state\_dependent\_GIRF/RBC\_state\_dependent\_GIRF.mod at master · JohannesPfeifer/DSGE\_mod · GitHub](https://github.com/JohannesPfeifer/DSGE_mod/blob/master/RBC_state_dependent_GIRF/RBC_state_dependent_GIRF.mod)
