When I adjust (adjust arch terms from 2 to 3 lags) and run the following code I got from Hamilton site, I get this error message:
Maxseek (205): error: G0058: index out of range
currently active call: echo 
echo called from: Maxseek 
Can anyone help me with this error?
This is because when you add another AR term, you also need to add an additional starting value to the variable
th in the procedure
startval, which begins around line 55 of the file Maxseek. In the original file,
th is a 13x1 vector. The comments around line 37-43 tell us what each of the elements of the
th vector represent:
//------ Input initial values for parameters ------------ /* The order in which variables are represented is as follows constant term in regression autoregressive terms in regression initial variance parameter constant term in ARCH equation */
So before you added the third AR term, the first element of
th was the starting value for the constant term in the regression,
th were the starting values for the autoregressive terms,
th was the starting parameter value for the initial variance parameter, etc.
To add a third AR term, you need to add an additional starting value to
th. This value should be as close as possible to the final answer--put in your best guess. Assuming that we thought 0.1 was a reasonable guess, we would change
th from the original (below):
let th[13,1] = 0.35080500 0.25003200 -0.56817500 0.027988000 -0.11706300 11.4016 0.051132 10.765493 0.1208310 4.3512660 13.146594 0.42415600 -5.2199370 ;
to this (notice the added 0.1):
let th[13,1] = 0.35080500 0.25003200 -0.56817500 0.1 0.027988000 -0.11706300 11.4016 0.051132 10.765493 0.1208310 4.3512660 13.146594 0.42415600 -5.2199370 ;
This is in addition to changing
karch to equal 3 on line 29, which I think you already did.