# IRF matching procedure

**URL:** <https://forum.dynare.org/t/irf-matching-procedure/17961>\
**Category:** SMM/GMM/IRF-Matching\
**Created:** [22 April 2021 16:52 UTC](https://forum.dynare.org/t/irf-matching-procedure/17961 "2021-04-22T16:52:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![alchi49](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/c37758/32.png) [@alchi49](https://forum.dynare.org/u/alchi49)\
**Post date:** [22 April 2021 16:52 UTC](https://forum.dynare.org/t/irf-matching-procedure/17961/1 "2021-04-22T16:52:34Z")

</div>

Dear Professor Pfeifer,

I was interested in the IRF matching procedure you have uploaded on your GitHub. I have used your code and your RBC model applied to Italian Data (Consumption, Output, Investment and Government spending) from 2007-2020 and it works well.

However, I tried your code on a more complex model (Kirchner & Wijnbergen (2016)) downloaded on the Macro-model data base that I have pimped a bit (Usefull public spending and Non Ricardian household) in order to get a positive response in consumption.

When I use this new model the IRFs for output Public spending and consumption start oscillating although this is not the case for standard IRFs produced by dynare .

I do not understand why the same code works for one model but not for the other one?

my guess is that it is due to the estimation of the AR(2) 's parameters?

Best[Matching\_my\_model.zip](https://forum.dynare.org/uploads/short-url/7zF36UEaLBHBWmNATwpAswipegs.zip) (24.2 KB)

Please find attached the different files I have used

---

<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 07:25 UTC](https://forum.dynare.org/t/irf-matching-procedure/17961/2 "2021-04-28T07:25:47Z")

</div>

It seems the reason is that your _empirical_ IRFs are oscillating and the model now mirrors that.

---

<div class="post-metadata">

**Author:** ![alexfra1709](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/ecc23a/32.png) [@alexfra1709](https://forum.dynare.org/u/alexfra1709)\
**Post date:** [18 March 2022 17:00 UTC](https://forum.dynare.org/t/irf-matching-procedure/17961/3 "2022-03-18T17:00:52Z")

</div>

Dear Prof Pfeifer,  
I am sorry for jumping into the discussion. Is there a way to do IRF matching for 3rd order approximation (i.e uncertainty shock) ? If yes can you briefly illustrate how it can be done? Thank you so much.

---

<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:** [19 March 2022 08:55 UTC](https://forum.dynare.org/t/irf-matching-procedure/17961/4 "2022-03-19T08:55:55Z")

</div>

The code at [DSGE\_mod/RBC\_IRF\_matching at master · JohannesPfeifer/DSGE\_mod · GitHub](https://github.com/JohannesPfeifer/DSGE_mod/tree/master/RBC_IRF_matching) should be straightforward to modify for third order. Within  
[DSGE\_mod/IRF\_matching\_objective.m at master · JohannesPfeifer/DSGE\_mod · GitHub](https://github.com/JohannesPfeifer/DSGE_mod/blob/master/RBC_IRF_matching/IRF_matching_objective.m)  
you would need to put the code for the IRFs at third order, which will depend on which type of IRFs you want. Do you want to use GIRFs at the stochastic steady state/EMAS?

---

<div class="post-metadata">

**Author:** ![alexfra1709](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/ecc23a/32.png) [@alexfra1709](https://forum.dynare.org/u/alexfra1709)\
**Post date:** [19 March 2022 12:47 UTC](https://forum.dynare.org/t/irf-matching-procedure/17961/5 "2022-03-19T12:47:44Z")

</div>

Dear Prof Pfeifer,  
Thank you for your prompt reply. Yes, indeed, I simulate the uncertainty shock using NLMA toolbox from Meyer Gohde and Lan (2013). This toolbox gives GIRFs at the stochastic steady-state and does not use the pruning method if I understand correctly. I award of Dynare do it with pruning and IRF from the ergodic mean (not sure about this point).  
Is it easier to switch to Dynare 3rd order simulation for IRF matching?  
Can it produce a huge difference from using NLMA toolbox ?  
Thank you so much for help.

---

<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:** [19 March 2022 16:41 UTC](https://forum.dynare.org/t/irf-matching-procedure/17961/6 "2022-03-19T16:41:55Z")

</div>

The basic framework should be able to accommodate the NLMA toolbox as well, but may require more work to integrate it.
