I got three questions on one side HP-filter and model fit to real data:

First, when doing Bayesian estimation, the real data (e.g. real output “y”) are first seasonally adjust, then take the log of the data and apply the one-sided HP-filter. My question is we can not use the one-sided HP-filter in Eviews as it is two-sided HP-filter, it must be done in Matlab, right? Can you give me an example code for one-side HP-filter of Matlab?

Second, if variable of the code is written in level, the observation is then : yobs=log(y)-log(steadystate y), where yobs is oberved variable (the data after first seasonally adjust, take log, one-sided HP-filter), is this right?

Third, when judging whether the estimation result fit the real data well, as the variable of the code is in level, I add log_y in “Definition of variables” , use the code "stoch_simul(order=1,hp_filter=1600); log_y ", then compare the theoritical moments (S.D or Correlations) with the statistics of the real data, is this right?

Really hope for your reply which always help me a lot, thank you, professor.
Best.

Dear professor, I am wandering if you can clearly explain to me why variables in log-linearization using hp_filter=1600, while variables in level using one_sided_hp_filter=1600in thestoch_simul` -command? I am really confused about the hp_filter option, always thank you and best wishes.

It’s not about logs vs. levels. Your data and model treatments need to be consistent for meaningful comparisons. You said you used the one-sided HP filter for the data, so you should use it for the model as well.

Dear @jpfeifer in almost similar model to check whether estimation result fit the real data well should I use the code stoch_simul(order=1, one_sided_hp_filter=1600) after the code estimation(order=1,datafile=Data, mode_check … etc) and compare MOMENTS OF SIMULATED VARIABLES with the statistics of the real data?

You opt for full consistency with respect to filtering and compare filtered objects in the model (i.e. using the one_sided_hp_filter-option of stoch_simul) with the filtered objects in the data.

You recognize that you provided filtered data to full information estimation and therefore asked the model in it’s unfiltered version to replicate the stochastic properties of the filtered data. Thus, you would compare unfiltered model variables to the filtered data.

@jpfeifer Thanks for your comment. I estimated the model and want to test how estimation result fits the real data well. So, for the second option you suggested, how should I code it in Dynare mod?