Use of Posteror_function after Estimation to Simulate Endogenous Variables

Hello, everyone!

I have been trying to estimate\simulate the time-series of deviation of endogenous variables from their steady states based on medium-scale DSGE model (written by Smets and Wouters (2007)). I want to compare how model generated variables perform relative to the real data. ‘Figure1’ attached to this message summarizes what I am trying to achieve. I thought ‘Smoothed Variables’ obtained after estimation works for that purpose. However, they are exactly the same as observable variables.
Therefore, I simulated the model right after the estimation, with the command stoch_simul(order=1, hp_filter=1600, periods=216). I chose the ‘periods’ option to be 216 because I want to study the data from 1966Q2 to 2020Q1. I do not know whether I am doing right or not. Could somebody tell me if I am in the right direction?

Also, I found some discussions about using the posterior-function after estimation to simulate the endogenous variables. Therefore, I am trying to obtain simulated variables by using posterior-function. However, I got the following error message:

“EXECUTE_POSTERIOR_FUNCTION: Execution of prior/posterior function led to an error. Execution cancelled.
Brace indexing is not supported for variables of this type.”

I do not know what is the error. Could somebody help me with this? Also, is there any difference between the use of stoch_simul option and posterior_function after estimation command? I mean do we get different results? I have attached the complete file as an attachment to this question.

Thank you very much for your time and help.

Regards,

Niraj
SmetsandWouters(2007).zip (40.2 KB)

Now we are back to square one.

I told you this:

As long as you don’t know what exactly you are trying to do, there is no answer.