Hi Tom,
I've updated the code you provided to replicate De Santis and Gerald (1998). For the variance model, they've used a parsimonious setting as below,
Ht=H0*(ll'-aa'-bb')+aa'*et-1*e't-1+bb'*Ht-1, the code is,
Code: Select all
frml hf = cc.*(l*tr(l)-a*tr(a)-b*tr(b))+(a*tr(a)).*uu{1}+(b*tr(b)).*h{1}
where h is the covariance matrix, H0 (cc) is the unconditional covariance matrix, l is s*1 vector of ones, a and b are s*1 vectors of unknown parameters, e (u) is the residual, * (.*) is the Hadamard (element by element) matrix product. In this setting, there're 2s parmaters to estimate.
De Santis and Gerald (1998) set H0 (the unconditional matrix) equal to the sample covariance matrix of the returns in the first iteration. Thereafter it is updated using the covariance matrix of the stimated residuals at the end of each iteration. In my code below, I've used the sample covariance matrix as H0 (cc=rr=%sigma), but I don't know how to update it in the way De Santis and Gerald (1998) used. Please kindly help.
Code: Select all
********************declare***********************************************************
dec series[vect] yv
dec frml[vect] residv
dec vect[series] u(n)
declare series[symm] h uu
declare symm hx(n,n)
declare vect ux(n)
*************************mean model***************************************************
nonlin(parmset=meanparms) rff wa wb wc wd we ma mb mc md me $
sa sb sc sd se pa pb pc pd pe
frml residv = yv- rff- $
(wa+wb*i1+wc*i2+wd*i3+we*i4)*%xcol(h,1)- $
(ma+mb*i1+mc*i2+md*i3+me*i4)*%xcol(h,2)- $
(sa+sb*i1+sc*i2+sd*i3+se*i4)*%xcol(h,3)- $
(pa+pb*i1+pc*i2+pd*i3+pe*i4)*%xcol(h,4)
gset h = %zeros(n,n)
gset yv = ||rw,rm,rs,spr,r1,r2,r3,r4,r5||
nlsystem(parmset=meanparms,frml=residv) gstart gend
compute rr=%sigma
dispaly rr
************************GARCH MODEL *************************************************
gset h * gend = rr
gset uu * gend = rr
declare frml[symm] hf
frml logl = $
hx = hf(t) , $
h(t) = hx, $
ux = residv , $
uu(t) = %outerxx(ux), $
%pt(u,t,ux),$
%logdensity(hx,ux)
*******************************************************************************************
dec symm cc(n,n)
dec vect l(n)
dec vect a(n) b(n)
compute cc=rr
*
compute l=%const(1)
nonlin(parmset=garchparms) a b
frml hf = cc.*(l*tr(l)-a*tr(a)-b*tr(b))+(a*tr(a)).*uu{1}+(b*tr(b)).*h{1}
maximize(parmset=meanparms+garchparms,$
pmethod=simplex,piters=10,method=bfgs,iters=500,subiterations=100) $
logl gstart gend
**************************************************************************************