One-sided Hodrick-Prescott filter
One-sided Hodrick-Prescott filter
I am struggeling with the end-point problem of the Hodrick-Prescott filter. Using a strictly one-sided HP filter seems to be a solution. Is there an easy way to implement this in the FILTER instruction? Any other suggestions to deal with the problem?
Thank you.
Thank you.
Re: One-sided Hodrick-Prescott filter
You would use DLM to do the local trend model that underlies the H-P filter and filter rather than smooth.
Code: Select all
*
* The HP filter is a local trend model. The system matrices for this can
* be generated using the procedure LOCALDLM with TYPE=TREND and
* SHOCKS=TREND.
*
@localdlm(type=trend,shocks=trend,a=ahp,c=chp,f=fhp)
*
* This is the relative variance of the measurement error to trend rate
* disturbance.
*
compute lambda = 1600.0
*
dlm(a=ahp,c=chp,f=fhp,sv=1.0,sw=1.0/lambda,presample=diffuse,$
type=FILTER,var=concentrate,y=lgdp) / hpstatesRe: One-sided Hodrick-Prescott filter
Thank you. Do I get that right that in your example the equivalent of the one-sided HP filter results is to be found in the first entry of the series hpstates (series of vectors)? What is the second entry? It's non-zero. Thanks again.
Re: One-sided Hodrick-Prescott filter
Correct. In this setup for the local trend model, the second state is the trend rate (i.e. local estimate of the rate of increase).Kraus wrote:Thank you. Do I get that right that in your example the equivalent of the one-sided HP filter results is to be found in the first entry of the series hpstates (series of vectors)? What is the second entry? It's non-zero. Thanks again.
Re: One-sided Hodrick-Prescott filter
Is there is a complete example code that implements the one-sided HP filter?
Re: One-sided Hodrick-Prescott filter
Take HPFILTER.RPF and change TYPE=SMOOTH to TYPE=FILTER on the DLM instruction. (The FILTER instruction only does the two-sided HP Filter which is why you do the local trend model using DLM).
Re: One-sided Hodrick-Prescott filter
Thanks Tom