Shock selection with inversion filter

Hi all,

I am trying to understand how estimation works with Occbin, and I’m using Johannes’ NKM.mod file (tests/occbin/filter · master · Dynare / dynare · GitLab) as a toy example.

One issue I encounter is the way Occbin selects shocks that need to drop out during the periods when some observable is constant, say the interest rate when the ZLB binds.

In Johannes’ file, the command
inx = strmatch(‘epsi’,M_.exo_names);
if any(isnan(inom))
M_.heteroskedastic_shocks.Qscale_orig.periods=find(isnan(inom));
M_.heteroskedastic_shocks.Qscale_orig.exo_id=inx;
M_.heteroskedastic_shocks.Qscale_orig.scale=0;
instructs Dynare to drop the monetary shock when the interest rate drops out of observables.

When I run the file as it is written, and estimate the model using the inversion filter, I get the expected result: epsi is zero when the ZLB binds. See Fig 1 attached.

When I slightly modify the file to reorder the declaration of shocks, say to
varexo
epsi (long_name=‘Notional interest rate shock’)
epss (long_name=‘Risk premium shock’)
epsg {\varepsilon_g} (long_name=‘Productivity growth shock’)
;
the output I get signals that Dynare chooses to drop the risk shock instead of the monetary shock. This is in spite of the command instructing Dynare to drop the monetary shock. See Fig 2.

Even weirder, the smoothed shocks are the same as before, but the labels have changed - ie what Dynare calls epss, which now drops out during the ZLB, exactly corresponds to the smoothed epsi from the original version.

I ran into the issue by adding more shocks to the model and I would like to understand what is going on.
Fig1
Fig2

There is a one to one mapping between the declared observables varobs and the shocks varexo. In the example, inom is the second varobs, which has NaN values. Whenever that is the case, Dynare will drop the second declared shocks. By default, that was epsi. But in your second try, you moved epss to the second position, so that becomes the new shock to drop.

This makes sense. Thank you for the feedback Johannes.

I think it would be useful to clarify this link between the order of declaration of shocks and varobs in the Manual. It seems unlikely that people will choose the correct declaration order by chance. (Unless it is already written somewhere and I missed it.)

Also I wonder then about the role of the following command lines:
M_.heteroskedastic_shocks.Qscale_orig.periods=find(isnan(inom));
M_.heteroskedastic_shocks.Qscale_orig.exo_id=inx;
M_.heteroskedastic_shocks.Qscale_orig.scale=0;

Does Dynare actually use these in estimation if the shock-varobs mapping is defined only by the declaration order? Or does it only play a role for the piecewise Kalman filter estimation?

I finally found the time to push a clarification for the manual:

The heteroskedastic_shocks is indeed only relevant for the PKF.

Thanks a lot. It’s super clear now.