I'm trying to write a program for a GARCH-M with an additional interaction term (Y(-1)*GARCH).
I'm having 2 problems - my first is that I'm getting missing values in @LOGL series and my second is, I'm not sure if I wrote the program right. Could I get some help with this?
I've attached my code:
Code: Select all
load eviewsoutput
sample s0 @first @first+2
sample s1 @first+3 @last
smpl s1
' declare coef vectors to use in ARCH likelihood
coef(3) beta = 0
coef(3) alpha = 0
coef(1) mu = 0
' get starting values
equation eq1.arch(1,1, archm=VAR) y c y(-1)
beta(1) = eq1.c(1)
beta(2) = eq1.c(2)
beta(3) = eq1.c(3)
alpha(1) = eq1.c(4)
alpha(2) = eq1.c(5)
alpha(3) = eq1.c(6)
mu(1) = eq1.@se^2
' set presample values of expressions in logl
smpl s0
series sig2 = mu(1)
series resma = resid
' set up GARCH likelihood
logl ll1
ll1.append @logl logl
ll1.append res = y - beta(2) - beta(1)*sig2 - beta(3)*sig2*y(-1)
ll1.append resma = res
ll1.append sig2 = alpha(1)+ alpha(2)*resma(-1)^2 + alpha(3)*sig2(-1)
ll1.append z = resma/@sqrt(sig2)
ll1.append logl = log(@dnorm(z)) - log(sig2)/2
' estimate and display results
smpl s1
ll1.ml(showopts, m=1000, c=1e-5)
show ll1.output
