# An inconsistency in filter\_step\_ahead with Laplace only

**URL:** https://forum.dynare.org/t/an-inconsistency-in-filter-step-ahead-with-laplace-only/4137
**Category:** Dynare help (legacy posts)
**Created:** [4 September 2014 17:50 UTC](https://forum.dynare.org/t/an-inconsistency-in-filter-step-ahead-with-laplace-only/4137 "2014-09-04T17:50:30Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![gin](https://forum.dynare.org/user_avatar/forum.dynare.org/gin/32/19654_2.png) [@gin](https://forum.dynare.org/u/gin)
#### Post date: [4 September 2014 17:50 UTC](https://forum.dynare.org/t/an-inconsistency-in-filter-step-ahead-with-laplace-only/4137/1 "2014-09-04T17:50:30Z")

</div>

Dear all,

To save time, I do the Laplace approximation only when estimating a model (i.e, set mh\_replic=0). But then the filter\_step\_ahead option in the estimation command gives the forecasts (i.e., in oo\_.FilteredVariablesKStepAhead) that are inconsistent with the case of mh\_replic\>0, i.e., the place of the variable is different - not of the same order as the order of variables under the estimation command.

gin

---

<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: [4 September 2014 19:49 UTC](https://forum.dynare.org/t/an-inconsistency-in-filter-step-ahead-with-laplace-only/4137/2 "2014-09-04T19:49:05Z")

</div>

Thanks for pointing this out. I will look into 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: [31 October 2014 11:02 UTC](https://forum.dynare.org/t/an-inconsistency-in-filter-step-ahead-with-laplace-only/4137/3 "2014-10-31T11:02:57Z")

</div>

Dear gin,

this is something that cannot easily be changed. We document the variable ordering now in the future manual.You can see it here: [github.com/JohannesPfeifer/dynare/commit/066653cf03f81541c32cca04b82a70bca8808c75](https://github.com/JohannesPfeifer/dynare/commit/066653cf03f81541c32cca04b82a70bca8808c75)

---

<div class="post-metadata">

### Author: ![gin](https://forum.dynare.org/user_avatar/forum.dynare.org/gin/32/19654_2.png) [@gin](https://forum.dynare.org/u/gin)
#### Post date: [14 May 2015 09:44 UTC](https://forum.dynare.org/t/an-inconsistency-in-filter-step-ahead-with-laplace-only/4137/4 "2015-05-14T09:44:52Z")

</div>

Johannes,

I still don’t get how the ordering in filter\_step\_ahead works in Laplace with Bayesian estimation [it is not the order of variable declaration].

Take Dynare 4.4.3. In estimation, specify filter\_step\_ahead. Indicate just one endogenous variable under the estimation command. If mh\_replic\>0 then everything is ok, that is, the variable will be the first and only in oo\_.FilteredVariablesKStepAhead (even without `selected\_variables\_only’ option).

But if mh\_replic=0 then 1) `selected\_variables\_only’ option does not work, and 2) filter\_step\_ahead is performed for all the endogenous variables in the model (222 in my case). Also, the order of the interested variable in oo\_.FilteredVariablesKStepAhead (#35) does not correspond to its order in the declared endogenous variables (#136).

PS: Attached is a mod-file (hopefully you don’t want to run it as it requires several more files).  
gin  
[ctw\_employer\_surplus100forecast1.mod](https://forum.dynare.org/uploads/default/original/2X/1/1c06add2371ac1d71cae387dd51a4f417d8f3798.mod) (72.1 KB)

---

<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: [18 May 2015 11:13 UTC](https://forum.dynare.org/t/an-inconsistency-in-filter-step-ahead-with-laplace-only/4137/5 "2015-05-18T11:13:20Z")

</div>

Yes, I need to run the code. Thus, please post a zip-file with everything that is required.

---

<div class="post-metadata">

### Author: ![gin](https://forum.dynare.org/user_avatar/forum.dynare.org/gin/32/19654_2.png) [@gin](https://forum.dynare.org/u/gin)
#### Post date: [18 May 2015 11:38 UTC](https://forum.dynare.org/t/an-inconsistency-in-filter-step-ahead-with-laplace-only/4137/6 "2015-05-18T11:38:36Z")

</div>

Johannes,

Attached is a zip-file `to\_johannes.zip’ with all files necessary to run the mod-file.

Please note that in order to run it faster (~8min on a quick desktop), I set `mode_compute=4' and provide a`mode\_file’.

gin  
[to\_johannes.zip](https://forum.dynare.org/uploads/default/original/2X/2/297e92bf2fd65f4949868be782e6a2190ce551bf.zip) (534 KB)

---

<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: [18 May 2015 14:14 UTC](https://forum.dynare.org/t/an-inconsistency-in-filter-step-ahead-with-laplace-only/4137/7 "2015-05-18T14:14:20Z")

</div>

In this case, they are stored in the order of

```auto

```

---

<div class="post-metadata">

### Author: ![gin](https://forum.dynare.org/user_avatar/forum.dynare.org/gin/32/19654_2.png) [@gin](https://forum.dynare.org/u/gin)
#### Post date: [18 May 2015 14:23 UTC](https://forum.dynare.org/t/an-inconsistency-in-filter-step-ahead-with-laplace-only/4137/8 "2015-05-18T14:23:09Z")

</div>

You are bright.

Thanks.  
gin

---

<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 May 2016 12:05 UTC](https://forum.dynare.org/t/an-inconsistency-in-filter-step-ahead-with-laplace-only/4137/9 "2016-05-17T12:05:29Z")

</div>

The new ordering (starting with Dynare 4.5) is documented in the manual
