Hi Zappa,
i solved the GJR-part in a similiar way.
I use a gaussian distribution for my errors. I used the one from the sample files. There is also a code for an ar(1)-garch model with t-distribution. Maybe the code can provide some help for writing an ar-garch-model.
Regarding the Bollerslev Robust Standard Errors: The Coeficients doesnt change, only the Covariance. But how do I calculate the robust Covariance? If you use the drop-down menu for ARCH-models you can simply choose bollerslev-robust-errors. In the programming manual you can find that h is the command for those robust errors. But it didnt work in my code.
I hope someone can help me with the calculation of the robust covariance (bollerslev-woolridge robust errors).
See my Code below:
f <- is a dummy-variabel that takes the value of 1 after a certain date
r_csi <- returns of the csi300 index
r_hs <- returns of Hang seng- Index
r_sp <- returns of S&P500
rl <- first lag of returns
Code: Select all
' set sample
sample s1 2 2
sample s2 3 1590
smpl s2
' get starting values from Gaussian ARCH
equation eq1
eq1.ls r_csi c Di Mi Do Fr r_sp(-1) r_hs r_csi(-1) r_csi(-3) f*r_csi(-1) f*r_csi(-3)
' declare and initialize parameters
coef(1) mu = eq1.c(1)
coef(1) d1 = eq1.c(2)
coef(1) d2 = eq1.c(3)
coef(1) d3 = eq1.c(4)
coef(1) d4 = eq1.c(5)
coef(1) gs = eq1.c(6)
coef(1) ls = eq1.c(7)
coef(1) rl = eq1.c(8)
coef(1) rl3 = eq1.c(9)
coef(1) f_rl = eq1.c(10)
coef(1) f_rl3 = eq1.c(11)
coef(1) omega = 0.00004
coef(1) alpha = 0.15
coef(1) beta = 0.6
coef(1) gamma = 0.05
coef(1) dum = 0
' set presample values of expressions in logl
smpl s1
series sig2 = omega(1)
series res = 0
' set up GARCH likelihood
logl ll1
ll1.append @logl logl
ll1.append res = r_csi-mu(1)-d1(1)*Di-d2(1)*Mi-d3(1)*Do-d4(1)*Fr-gs(1)*r_sp(-1)-ls(1)*r_hs-rl(1)*r_csi(-1)-rl3(1)*r_csi(-3)-f_rl(1)*f*r_csi(-1)-f_rl3(1)*f*r_csi(-3)
ll1.append sig2 = (omega(1)+alpha(1)*res(-1)^2 +beta(1)*sig2(-1)+gamma(1)*`res(-1)^2*(res(-1)<0))*(1+dum(1)*f)
ll1.append z = res/@sqrt(sig2)
ll1.append logl = log(@dnorm(z)) - log(sig2)/2
' estimate and display output
smpl s2
ll1.ml(showopts, m=1000, c=1e-5,b,h)
show ll1.output
I hope someone can help me with the calculation of the robust covariance (bollerslev-woolridge robust errors).
Thanks