# Stoch simul(options) - HP filter

Hello,
I am wondering why we have option HP filter in the block of “stoch_simul”. We actually do not use data until this block, only working with the theoretical model, right? So why do we use HP filter when there is no data to filter?

I just quickly searched on the forum and found some one saying about this 'If you do calibration and compare the theoretical moments of your model with HP filtered data, it seems more consistent to compare the HP_filtered theoretical moments and the HP_filtered data"

I am confused on “HP_filtered theoretical moments” I thought filtering is meant for data only? But it seems for theoretical things as well?

Thank you,

Dynare’s stoch_simul command can compute HP filtered simulated data but also second order theoretical moments of filtered variables. We do not need data to compute the ergodic variance of a filtered variable. The variance can be computed as an integral of the spectral density over the whole domain of frequencies. To compute the unconditional variance of an HP filtered variable we just have to integrate the same spectral density over a subdomain of frequencies (removing the lowest frequencies, the threshold depends on the value of the HP’s \lambda parameter).

The relation between the autocovariance function and the spectral density is explained in details in Hamiton’s textbook “Time Series Analysis” (chapter 6, section 1, see proposition 6.1 and below).

Best,
Stéphane.

1 Like

I should add that the Dynare manual provides an explicit reference for the theoretical HP-filtered moments, namely Uhlig (2001)