let me say upfront that I am not a big estimation expert.
I am estimating a model using Bayesian methods and would like the do the following experiment: after estimating the model, I would like to feed the estimated shocks back into the estimated model to run counterfactuals and historical decompositions.
What I am currently doing to implement this is the following:
During the estimation, I save the estimated shocks (which are stored by Dynare in the “innov” matrix) adding a line saying “save innov” around line 800 in the file dynare_estimation.m
After estimation, I simulate the estimated model replacing the “ex_” matrix inside the simult.m file with the “innov” matrix itself.
My understanding is that the innov are the smoothed shocks and do not replicate the model exactly when I feed them back in the model. In fact, model and actual series do not line up exactly. I was wondering whether there is a way conceptually and practically to do the counterfactuals in the model better than the one I am currently using
You don’t need to dig into dynare_estimation. After estimation, the smoothed shocks are available in dr_.posteriorSmoothedShocks
The simulation with the smoothed shocks should replicate exactly the observed variable. Be careful about ordering the variables. It isn’t straightforward in simult_.m. Be careful about intercept, too.
You can send me your program or post it on the forum
thanks for your tip. I will send you the file in the next days, once I have checked a few things. I just want to be sure about your point: should the smoothed shocks should replicate exactly the (1)actual variables or (2) the smoothed variables. It seems to me that (1) and (2) are not identical, and that the smoothed shocks replicate (2) not (1). But maybe I am missing something. I will keep you posted.
In my exprerience the smoothed values of the observed variables are identical to the observations. If you have an example where it isn’t the case, please send it to me
If I may add something… Smoothed variables should correspond to actual variables when there are no measurement errors.