# Applying BP filter in DSGE Model

**URL:** https://forum.dynare.org/t/applying-bp-filter-in-dsge-model/5429
**Category:** Dynare help (legacy posts)
**Created:** [8 April 2016 13:07 UTC](https://forum.dynare.org/t/applying-bp-filter-in-dsge-model/5429 "2016-04-08T13:07:11Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Eriador](https://forum.dynare.org/letter_avatar_proxy/v4/letter/e/a183cd/32.png) [@Eriador](https://forum.dynare.org/u/Eriador)
#### Post date: [8 April 2016 13:07 UTC](https://forum.dynare.org/t/applying-bp-filter-in-dsge-model/5429/1 "2016-04-08T13:07:11Z")

</div>

Hi,

I am trying to apply a Band pass filter in my RBC DSGE model. I have had a look at the codes and cannot find them anywhere.  
If anyone can find or help me with finding or creating the code would be very helpful.  
Thank you in advance.

E

---

<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 April 2016 16:43 UTC](https://forum.dynare.org/t/applying-bp-filter-in-dsge-model/5429/2 "2016-04-17T16:43:58Z")

</div>

In the current unstable version, there is an option

```auto

```

for this. See [github.com/DynareTeam/dynare/blob/master/tests/moments/example1\_bp\_test.mod](https://github.com/DynareTeam/dynare/blob/master/tests/moments/example1_bp_test.mod)

---

<div class="post-metadata">

### Author: ![Eriador](https://forum.dynare.org/letter_avatar_proxy/v4/letter/e/a183cd/32.png) [@Eriador](https://forum.dynare.org/u/Eriador)
#### Post date: [16 August 2016 17:05 UTC](https://forum.dynare.org/t/applying-bp-filter-in-dsge-model/5429/3 "2016-08-16T17:05:49Z")

</div>

Thank you for your response.

I have found a way to convert the data beforehand and then use that in estimating parameters for the NK model.

---

<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: [16 August 2016 17:15 UTC](https://forum.dynare.org/t/applying-bp-filter-in-dsge-model/5429/4 "2016-08-16T17:15:53Z")

</div>

Please be aware of the pitfalls of filtering when doing Bayesian estimation. See Pfeifer(2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models” [sites.google.com/site/pfeiferecon/Pfeifer\_2013\_Observation\_Equations.pdf](https://sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf).

---

<div class="post-metadata">

### Author: ![Eriador](https://forum.dynare.org/letter_avatar_proxy/v4/letter/e/a183cd/32.png) [@Eriador](https://forum.dynare.org/u/Eriador)
#### Post date: [16 August 2016 19:24 UTC](https://forum.dynare.org/t/applying-bp-filter-in-dsge-model/5429/5 "2016-08-16T19:24:14Z")

</div>

Thank you for the prompting me. I have had a look through your guide. I am using Smet wouters 2007 data and the codes are all there for me to use on the NK model estimation. I will be using Bayesian estimation, if you can elaborate more on some of the problems so I can research it.

---

<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 August 2016 06:37 UTC](https://forum.dynare.org/t/applying-bp-filter-in-dsge-model/5429/6 "2016-08-17T06:37:47Z")

</div>

When doing Bayesian estimation, you should use a first difference filter or linear trend, not a two-sided filter like a bandpass or two-sided HP filter

---

<div class="post-metadata">

### Author: ![Eriador](https://forum.dynare.org/letter_avatar_proxy/v4/letter/e/a183cd/32.png) [@Eriador](https://forum.dynare.org/u/Eriador)
#### Post date: [17 August 2016 10:34 UTC](https://forum.dynare.org/t/applying-bp-filter-in-dsge-model/5429/7 "2016-08-17T10:34:40Z")

</div>

Thank you for your help. I will include this in my analysis.
