Multivariate HP filter

Discussion of State Space and Dynamic Stochastic General Equilibrium Models
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Multivariate HP filter

Unread post by TomDoan »

Why are you accumulating the estimate? r-bar is the first state.

You didn't include SV in your options, so you only have a rank one error process. You also need to define C, SW and SV as FRML's (or put them directly into the DLM instruction the way you're handling MU), since they depend upon free parameters. (See the User's Guide if you're unclear about this).

You also want METHOD=BFGS, so it estimates rather than solving.
mskare69
Posts: 27
Joined: Tue May 10, 2011 3:35 pm

Re: Multivariate HP filter

Unread post by mskare69 »

Dear Tom,

Would be this a final, working code with frml instructions, hp parameter 6.25 for annual data. Could you please rerun the code and let me know what you think.

Many thanks,

Marinko

Code: Select all

*
open data data1.xls
calendar(a) 1800
data(format=xls, org=columns) 1800:1 2012:1 ytilde qtilde r a2
compute a=||1.0,1.0,0.0|0.0,1.0,0.0|1.0,0.0,0.0||
compute f=||0.0|1.0|0.0||
declare vector alpha(3) sigma(3)
nonlin sigma0 sigma1 sigma2 alpha1 alpha2 alpha3
linreg ytilde
# constant ytilde{1} a2{1} qtilde{1}
compute alpha1=0.56,alpha2=0.0003,alpha3=-0.005,sigma2=sqrt(%seesq)
compute sigma1=3.008
compute sigma0=sqrt(6.25)*sigma1
decl frml[rect] sv sw c
frml sv = %diag(||sigma0^2,sigma2^2||)
frml sw = sigma1^2
frml  c = ||1,0|0,0|0,-alpha2||
dlm(sw=sw,sv=sv,c=c,a=a,f=f,y=||r,ytilde||,presample=diffuse,pmethod=simplex,piters=5,exact,method=bfgs,type=smooth, mu=||0.0|alpha1*ytilde{1}+alpha2*r{1}+alpha3*qtilde{1}||) 1800:1 * xstates
set NRI 1800:1 * = xstates(t)(1)
graph(footer="Natural interest rate, HPMV estimation")
# NRI
print / NRI
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Multivariate HP filter

Unread post by TomDoan »

I certainly would never have chosen a local trend model (which is what underlies the H-P filter) for the real rate of interest---a local level model would have made more sense. However, there probably is little difference in practice. What you have now appears to be a reasonable replication of their method.
Post Reply