An inconsistency in filter_step_ahead with Laplace only

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.


Thanks for pointing this out. I will look into it.

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:


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).
ctw_employer_surplus100forecast1.mod (72.1 KB)

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


Attached is a zip-file `’ 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 amode_file’.

gin (534 KB)

In this case, they are stored in the order of

You are bright.


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