Baxter & King as an endogenous variable

Hello everybody!

I would like to compute the Baxter and King filter of output in the model section treating it as an endogenous variable, say Y_BK. Is it possible to do something like this in dynare?

From what I can see, the Baxter/King filter has a state space representation that you could use to manually define the filtered output in your model.

Where can I find the formula for its state-space representation?

Their paper shows how to compute the moving average weights.

So, I computed them and them used stoch_simul; but the IRFs I get look strange:

Attached you can find my .mod file.
NK_Model.mod (6.9 KB)

Comparing your computed weights to the one used in Matlab’s bkfilter.m, you flipped the order of lower and upper cutoff. It should be:

p_l     = 32;
p_h     = 6;

Thanks for noticing it! I tried now, but still get “ugly” IRFS:

It seems that if I increase the higher frequency (I set p_h=2), I get a smoother responses:

do you have an intuition for this?