Hi,
Regarding (1), you don't actually need to include a lead term in the state vector. In the paper that you provide a link to, the authors have written the model using a "future version" of the state-space form. In a companion paper, the authors express the
same model in the "contemporaneous version" of the state-space form. The companion paper is available here:
http://www.bis.org/publ/work404.pdf. To circumvent the lead term problem that you've encountered, follow paper 404, instead of paper 442.
The "static" version of the HP filter is thus shown in the code below.
Code: Select all
' Measurement equation
static_hp.append @signal Y = Y_STAR + EPS1
static_hp.append @ename EPS1
static_hp.append @evar var(EPS1) = 1
' State equation (Y_STAR)
static_hp.append @state Y_STAR = 2 * Y_STAR(-1) - 1 * Y_STAR2(-1) + EPS0
static_hp.append @ename EPS0
static_hp.append @evar var(EPS0) = 1 / 1600
' State equation (Y_STAR2) - this is an "augmented" state variable
static_hp.append @state Y_STAR2 = Y_STAR(-1)
Answering (2) is a little trickier, but let's try.
First, let's write the code for the "dynamic" version of the HP filter. This is shown in the code below.
Note that there is a constraint on the beta parameter such that 0 < beta < 0.95 and this is written in EViews code below as (0.95 - exp(c(1))). For more information about parameter constraints, see the following thread:
viewtopic.php?t=48.
Code: Select all
' Measurement equation
dynamic_hp.append @signal Y = Y_STAR + EPS2 + (0.95 - exp(c(1))) * (Y(-1) - Y_STAR2)
dynamic_hp.append @ename EPS2
dynamic_hp.append @evar var(EPS2) = 1
' State equation (Y_STAR)
dynamic_hp.append @state Y_STAR = 2 * Y_STAR(-1) - 1 * Y_STAR2(-1) + EPS0
dynamic_hp.append @ename EPS0
dynamic_hp.append @evar var(EPS0) = 1 / 1600
' State equation (Y_STAR2) - this is an "augented" state variable
dynamic_hp.append @state Y_STAR2 = Y_STAR(-1)
The final part involves introducing a scaling factor. I think you can do this by multiplying the variance of EPS0 by some number. To find the correct scaling factor requires iterating until the condition below holds. This is the same condition that you referred to.
VAR[Y(t) - Y*(hp, t)] / VAR[∆Y*(hp, t) - ∆Y*(hp, t-1)] = VAR[Y(t) - Y*(alt, t)] / VAR[∆Y*(alt, t) - ∆Y*(alt, t-1)]
You can calculate the left hand side of the condition as shown below, where HPT is a double differenced static HP trend (∆Y*(hp, t) - ∆Y*(hp, t-1)) and HPC is the cyclical component from the static HP model (Y(t) - Y*(hp, t)).
Code: Select all
series DD_HPT = d(HPT,2)
scalar STATIC_HP_RATIO = @stdev(HPC) / @stdev(DD_HPT)
The next step is to make the same calculations above using the trend and cycle from the dynamic HP filter. To do this, just replace HPT with the dynamic filter trend and HPC with the dynamic filter cycle. This will give you an estimate for the DYNAMIC_HP_RATIO. This is the right hand side of the condition.
Lastly, multiply the variance of EPS0 by some number which brings DYNAMIC_HP_RATIO in line with STATIC_HP_RATIO. In other words, change the lines of code below until this condition holds: DYNAMIC_HP_RATIO = STATIC_HP_RATIO.
Code: Select all
scalar scale = 2 ' Keep changing this number until the two ratios are equal
dynamic_hp.append @evar var(EPS0) = 1 / 1600 * scale
The same method seems to work when introducing financial variables. Note, however, that this method using EViews is classical in spirit whereas the authors use a Bayesian approach. For that reason, you may need to estimate the model parameters (beta and gamma(s)) a few times and then calibrate them once you find acceptable coefficients. In effect, you can do a poor man's Bayesian estimation to get the model to work.
Hope this helps.
Cheers,
Graeme