Clarification on stochastic simulation

I’d like to ask a clarifying question regarding the stochastic simulation of a medium-sized model.

Let’s say, for the sake of simplicity, that I have an empirical data set. It is made up of a single observation: output. This data is at a monthly frequency and I have filtered it using an HP-filter with smoothing parameter lambda = 129,600. In order to define the percent deviation from the steady-state, I take the log-difference from its HP-filtered trend. I estimated an AR(1) model for the percent deviation and let’s say that the persistence parameter is 0.95.

Now, I’d like to simulate this variable in dynare. In my non-linear model, I have defined output as

y = y-bar*exp(yhat),

where y-bar is steady-state output (normalized to 1), and yhat is a mean-zero, AR(1) process, such as

yhat = phi*yhat(-1) + e_y

so that in steady-state, we get just y = y-bar = 1. The reason I defined output in this way is that if I log-linearize y, I simply get yhat, the AR(1) process. In the parameter section of the .mod file, I have specified that phi is equal to 0.95, just like in the empirical counterpart.

Now, here’s the problem. In my stochastic_simul command, I have specified that I want to simulate the model 100,000 times and drop the first 10,000 before estimating the empirical moments. Additionally, I have added the hp-fllter = 129,600 sub-command, again so that I am comparing apples to apples.

Out of curiosity, and to double-check, I took the simulated series for y and estimated it outside of dynare on a separate statistical package. I repeated the same steps I did with the actual empirical data for output (HP-filtered, then log-differenced), but when I estimated the AR(1) model, I got a coefficient of phi = 0.90.

Did I do something stupid? I’d like to make dynare reproduce a series for y which is statistically a “clone” to the empirical data. Thank you ahead of time. If it helps, I can go ahead and write a .mod file for this; the question above is a simplified version of the actual problem, but a solution to the above would solve the more complex problem for me.

I am not sure I understand your procedure completely, but

  1. You are supposed to take the logarithm before applying the HP-filter.
  2. If I understand you correctly, you base your estimate of the autocorrelation phi on the filtered empirical data. But what you do now is to set the autocorrelation in the unfiltered model data. That data will have the desired autocorrelation. But then you apply the HP-filter to the model data and the autocorrelation in that filtered data will of course be different. For your approach to work, you would need to do a indirect inference approach where you target the autocorrelation of the filtered series and chose phi accordingly.