Estimated shocks from data and simulate model to fit data

Hi professor, I was replicating the paper “Collateral constraints and macroeconomic asymmetries”. I have two questions about how to simulate models to fit the data.

The first one is : how to filter shock sequence from data. As mentioned in this paper where I underlined the sentences, author abstract shock sequence from the data and then feed the model. could you please give me a hint about how to realize it? can Dynare realize it?

The second one: How to simulate the model to fit the data. As in paper, author simulate the model to fit the data in recession. but I have no idea about how to do with it. Does it mean that I need to feed an estimated shocks from the data so that I can simulate the model? Any suggestion is appreciated.

This is done by estimating the model with an inversion filter. Dynare 5 does support estimating models with Occbin. See the manual.