* * GARCHDECO.RPF * Multivariate GARCH with DECO estimator. * * Method (not example) from Engle and Kelly(2011), "Dynamic * Equicorrelation", Journal of Business & Economic Statistics, vol 30, * no 2, pp 212-228. * 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) * * 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) end do i * * Compute the covariance matrix of the standardized residuals. * vcv(matrix=rr,nocenter,noprint) # eps * * When "dotted" with a correlation matrix, the "summer" matrix will * compute the average of the pairwise correlations. * dec symm summer(n,n) ewise summer(i,j)=1.0/(n*(n-1))*(i<>j) * * Create a series for the sequential estimates of rho. This is * initialized to an estimate of rho given the full data set. (Not really * necessary to do the latter). * compute rhox=%dot(summer,%cvtocorr(rr)) set rho = rhox * * Set the target matrix to the equicorrelated estimate using the full * sample. * ewise rr(i,j)=%if(i==j,1.0,rhox) * * 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 * * Compute the sums across i at t needed later * set sumsq = %sum(%xt(eps,t).^2) set sqsum = %sum(%xt(eps,t))^2 * * Log likelihood for the DECO phase, taking the standardized 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,rho=%dot(summer,%cvtocorr(qx)),-.5*\$ (n*log(2*%pi)+(n-1)*log(1-rho)+log(1+(n-1)*rho)+1.0/(1-rho)*(sumsq-rho/(1+(n-1)*rho)*sqsum)) compute b=.80,a=.10 maximize logl 2 *