On Tue, 20 Mar 2012, Daniel Bencik wrote:
Hello Allin,
I humbly ask you for help with hopefully the last problem.
I would like to estimate an AR(1)-GARCH(1,1) model with T-distributed
normalized residuals. I take the loglik function from
http://faculty.chicagobooth.edu/jeffrey.russell/teaching/finecon/readings...
p15 and transform everything into code.
[...]
It's difficult to see what goes wrong without looking at the data. On my
machine, the script below (in which I use your code almost unmodified,
except for starting values and the usage of the lngamma() function instead
of log(gammafun())) runs just fine. At the end of the script, you also get
an example of how to estimate the same model using gig.
<hansl>
open djclose.gdt -q
y = 100*ldiff(djclose)
# allRng[t] = c + a1*allRng[t-1] + e[t]
scalar c = 0.05
scalar a1 = 0.025
# e[t] = h[t] * Student[t]
# GARCH - h[t] = cg + ga*h[t-1] + arc*e^2[t-1]
scalar cg = 0.025
scalar ga = 0.95
scalar arc = 0.04
scalar dof = 6
mle ll = lngamma((dof + 1)/2) - lngamma(dof/2) - 0.5*log(dof-2) - \
log(h) - 0.5*(dof + 1)*log(1 + (dof - 2)^(-1)*h^(-2)*e^2)
series e = 0
series e = y - c - a1*y(-1) #AR1 process
series h = var(y)
series h = cg + ga*h(-1) + arc*(e(-1))^2 # GARCH(1,1)
params c a1 cg ga arc dof
end mle
/* ------ through gig ---------------------------------- */
include gig.gfn
moo = gig_setup(y,1,const,null,1)
gig_set_dist(&moo,1)
gig_estimate(&moo)
</hansl>
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti