Moments of simulated variables

The Dynare online manual states that (version 3)

"Currently, the HP filter is only available when computing theoretical moments, not for for moments of simulated variables. "
dynare.org/manual/re26.html *

I was wondering whether this has been fixed - it does not seem so browsing through disp_moments.m -, and if not, why. It would seem to me that one just needs to add a few lines of command to disp_moments after the line that says:
y = y(ivar,options_.drop+ykmin_+1:end)’;

something like…

if options_.hp_filter > 1
for i=1:size(y,2)
[y(:,i) t(:,i)]=hpfast(y(:,i));
end
end

is it true?

NB: * new url

Hi,

This limitation of Dynare is still present: HP filter can only be applied on theoretical moments, not for moments of simulated variables.

There is no good reason for that, except lack of time for adding it.

Where does the “hpfast” function in your code come from? I can’t see it in Matlab nor Dynare.

Best,

Sébastien

The function hpfast was available under Dynare 3 (it is still available in the repository, just google hpfast dynare to find it). Essentially, it HP filters a series into a trend and a cycle. The fix I suggested in the post below should be all that is needed.