* * Multivariate GARCH with two-step DCC estimator * all 6237 open data g10xrate.xls data(format=xls,org=columns) / usxjpn usxfra usxsui usxnld usxuk usxbel usxger usxcan * compute n=8 dec vect[series] x(n) compute i=0 dofor [string] s = 'jpn' 'fra' 'sui' 'nld' 'uk' 'bel' 'ger' 'can' compute xrate='usx'+s,i=i+1 set x(i) = 100.0*log(%s(xrate)/%s(xrate){1}) end dofor * * dec vect[series] eps(n) dec vect fullbeta(4*n+2) * * Do univariate GARCH models. Save the standardized residuals * into eps(i). Copy the coefficients into the proper slots in * the full beta matrix. * do i=1,n garch(p=1,q=1,resids=r,hseries=h) / x(i) set eps(i) = r/sqrt(h) do j=1,4 compute fullbeta(n*(j-1)+i)=%beta(j) end do j end do i * * Compute the covariance matrix of the standardized residuals * vcv(matrix=rr) # eps * * Create the series[symm] uu (outer product of residuals). Make * it the unconditional value prior to the sample. * dec series[symm] uu q gset uu %regstart() %regend() = %outerxx(%xt(eps,t)) gset uu 1 %regstart()-1 = rr gset q = rr * * Log likelihood for the DCC phase, taking the residuals as given * nonlin a b dec frml[symm] qf frml qf = (qx=(1-a-b)*rr+a*uu{1}+b*q{1}) frml logl = q=qf,%logdensity(%cvtocorr(q),%xt(eps,t)) compute b=.80,a=.10 maximize logl 2 * * * Compute the estimates into the final two slots in fullbeta * compute fullbeta(4*n+1)=%beta(1),fullbeta(4*n+2)=%beta(2) * * Do one iteration of the full model with METHOD=BHHH to get * the grand covariance matrix. * garch(p=1,q=1,mv=dcc,method=bhhh,initial=fullbeta,iters=1) / x