As with your other example, there are minor differences in the initialization.
GARCH uses 1/T rather than 1/(T-k) in computing the variance for the pre-sample values.
GARCH also can estimate starting with entry 2, as it handles the two lags of the variance internally, while
MAXIMIZE won't let you use entry 0 for the 2nd lag of H.
Your biggest problem, however, is with the guess values: a=.11,b=.86, b2=0.3. Those are
really explosive. If the variance overflows at the guess values, you'll get a truncated data set, as
MAXIMIZE will restrict itself to the subset of data where the model can be calculated.
The following will give identical answers for
MAXIMIZE and
GARCH. This comes at the cost of dropping a data point for the
GARCH (it could start at 2).
Code: Select all
OPEN DATA garch.asc
DATA(FORMAT=PRN,NOLABELS,ORG=COLUMNS) 1 1867 BP CD DM JY SF
set dlogdm = 100*log(dm/dm{1})
*
linreg dlogdm 3 *
# constant
frml(lastreg,vector=beta) meanf
nonlin(parmset=meanparms) beta
*
set uu = %sigmasq
set h = %sigmasq
set u = 0.0
*
nonlin(parmset=garchparms) c a b b2
compute c=%seesq*.1,a=.11,b=.70, b2=.05
frml varf = c+a*uu{1} + b*h{1} + b2*h{2}
*
frml logl = (u=dlogdm-meanf),(uu(t)=u^2),(h(t)=varf(t)),%logdensity(h,u)
maximize(parmset=meanparms+garchparms,trace) logl 3 *
garch(p=2,q=1) 3 * dlogdm
An alternative, which gets the whole range on both, is to shift the data set up an entry with:
DATA(FORMAT=PRN,NOLABELS,ORG=COLUMNS) 2 1868 BP CD DM JY SF