Hi,
Your script is confusing me a bit;)
 
so if I had an arch process that was arch 24 and arima 1 1 would I change the script to this:

open "C:\Documents and Settings\cquilley\Application Data\gretl\mydata.gdt"
/*
  compute 1-step pred. errs + cond. variances
*/

function filter(series y, \
 scalar arpar, scalar mapar, \
 scalar om, scalar alpha1, scalar alpha2, \
 scalar alpha3, scalar alpha4, scalar alpha5, \
 scalar alpha6, scalar alpha7, scalar alpha8, \
 scalar alpha9, scalar alpha10, scalar alpha11, \
 scalar alpha12, scalar alpha13, scalar alpha14, \
 scalar alpha15, scalar alpha16, scalar alpha17, \
 scalar alpha18, scalar alpha19, scalar alpha20, \
 scalar alpha21, scalar alpha22, scalar alpha23, \
 scalar alpha24, \
 series *e, series *h)

  scalar err = 0
  scalar T = $nobs
  series e = 0
  series h = om/(1-alpha1-alpha2-alpha3-alpha4-alpha5-alpha6-alpha7-alpha8-alpha9-alpha10-alpha11-alpha12-alpha13-alpha14-alpha15-alpha16-alpha17-alpha18-alpha19-alpha20-alpha21-alpha22-alpha23-alpha24)

  loop for i=2..T --quiet
    scalar e2lag = e[i-1]^2
    scalar e3lag = e[i-2]^2
    scalar e4lag = e[i-3]^2
    scalar e5lag = e[i-4]^2
    scalar e6lag = e[i-5]^2
    scalar e7lag = e[i-6]^2
    scalar e8lag = e[i-7]^2
    scalar e9lag = e[i-8]^2
    scalar e10lag = e[i-9]^2
    scalar e11lag = e[i-10]^2
    scalar e12lag = e[i-11]^2
    scalar e13lag = e[i-12]^2
    scalar e14lag = e[i-13]^2
    scalar e15lag = e[i-14]^2
    scalar e16lag = e[i-15]^2
    scalar e17lag = e[i-16]^2
    scalar e18lag = e[i-17]^2
    scalar e19lag = e[i-18]^2
    scalar e20lag = e[i-19]^2
    scalar e21lag = e[i-20]^2
    scalar e22lag = e[i-21]^2
    scalar e23lag = e[i-22]^2
    scalar e24lag = e[i-23]^2
    scalar e25lag = e[i-24]^2
    e[i] = y[i] - (arpar*y[i-1] + mapar*e[i-1])
    h[i] = om + alpha1*e2lag + alpha2*e3lag + alpha3*e4lag \
    + alpha4*e5lag + alpha5*e6lag + alpha6*e7lag + alpha7*e8lag \
    + alpha8*e9lag + alpha9*e10lag + alpha10*e11lag + \
    alpha11*e12lag + alpha12*e13lag + alpha13*e14lag + \
    alpha14*e15lag + alpha15*e16lag + alpha16*e17lag + \
    alpha17*e18lag +alpha18*e19lag + alpha19*e20lag + \
    alpha20*e21lag + alpha21*e22lag +alpha22*e23lag + \
    alpha23*e24lag + alpha24*e25lag
  end loop

  return scalar err


end function
/* now with a non-zero an MA part */

series y = TOTAL


scalar phi = 0
scalar theta = 0
scalar a1 = 0.1
scalar a2 = 0.1
scalar a3 = 0.1
scalar a4 = 0.1
scalar a5 = 0.1
scalar a6 = 0.1
scalar a7 = 0.1
scalar a8 = 0.1
scalar a9 = 0.1
scalar a10 = 0.1
scalar a11 = 0.1
scalar a12 = 0.1
scalar a13 = 0.1
scalar a14 = 0.1
scalar a15 = 0.1
scalar a16 = 0.1
scalar a17 = 0.1
scalar a18 = 0.1
scalar a19 = 0.1
scalar a20 = 0.1
scalar a21 = 0.1
scalar a22 = 0.1
scalar a23 = 0.1
scalar a24 = 0.1
scalar omega = var(y)*(1-a1-a2-a3-a4-a5-a6-a7-a8-a9-a10-a11-a12-a13-a14-a15-a16-a17-a18-a19-a20-a21-a22-a23-a24)

series ht = 1
series et = 0

mle loglik = -0.5*(log(ht) + ut)
  scalar err = filter(y, phi, theta, omega, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a15, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, &et, &ht)
  series ut = et^2/ht
  params phi, theta, omega, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a15, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24
end mle --verbose

?
When I run this I get the error "Bad character 'i' in date string" and the script halts. Also, the script only appears to output the estimated alphas and arima coefficients. How would I modify this to get a more garch like output with coefficients estimated for the function total = B1 + B2*X2 + B3*X3? i.e how do I get it to estimate the B's as well?
 
Thanks,
 
Chris
 
On 6/5/07, Riccardo (Jack) Lucchetti <r.lucchetti@univpm.it> wrote:
On Tue, 5 Jun 2007, Chris wrote:

> is there any way to combine arima with arch? Is this a stupid question? When
> I run the arima stuff I get a fantastic fit to the data, but when I run the
> arch test it shows I definitely have an arch process.

At the moment there is no native command that allows you to run a combined
ARMA+ARCH model in gretl. You have 2 alternatives:

1) If your arma model doesn't include a MA part, just add lags of the
dependent variable as regressors: this will give you conditional maximum
likelihood, which is asymptotically equivalent to full ML.

2) If you really need full ML, you can write a function taking the
observed series and the parameters as input and returning the
one-step-ahead prediction errors plus the conditional variances and stick
that into an mle block. You can use the attached script (rough
proof-of-concept) as a template.


Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche

r.lucchetti@univpm.it
http://www.econ.univpm.it/lucchetti
_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users