[Gretl-users] AR-GARCH-t MLE

Sven Schreiber svetosch at gmx.net
Tue Mar 20 16:04:08 EDT 2012

```Hi,

a shot in the dark, and I'm not a big practitioner of gretl's mle, but:
your h doesn't seem to be necessarily positive for all data
constellations. That would get log(h) into trouble and possibly make the
assignment to ll fail. So maybe check your h (and/or whether arc>0). In
any case, the error message that gretl issues in your case doesn't seem
to be super helpful...

cheers,
sven

On 03/20/2012 07:27 PM, 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/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
>
> _______________________________________________
> Gretl-users mailing list
> Gretl-users at lists.wfu.edu
> http://lists.wfu.edu/mailman/listinfo/gretl-users

```