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/glossary.pdf
 p15 and transform everything into code. 


# allRng[t] = c + a1*allRng[t-1] + e[t]
scalar c = 0.1
scalar a1 = 0.1

# e[t] = h[t] * Student[t]
# GARCH - h[t] = cg + ga*h[t-1] + arc*e^2[t-1]
scalar cg = 0.1
scalar ga = 0.1
scalar arc = 0.1
scalar dof = 4

mle ll = log(gammafun((dof + 1)/2)) - log(gammafun(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 = allRng - c - a1*allRng(-1)       #AR1 process
    
    series h = var(allRng)
    series h = cg + ga*h(-1) + arc*(e(-1))^2    # GARCH(1,1)
   
    params c a1 cg ga arc dof
end mle

You may have noticed a comment mark on the "mle ll=" line. This is where the 
error happens. I receive an error message telling me "The variable ll is of 
type scalar". The error disappears when I move the comment mark in front of the 
log(h) element. I looked into other MLE estimates of garch using gretl on the 
web, some of my own MLE estimates using gretl and I just cant figure out what 
the problem is here. 

Thank you in advance, 
Daniel

Reply via email to