options crt; ? ? MARCH2: Multivariate ARCH via ML ? TSP 4.2A (September 1992) ? Author: Clint Cummins ? ? p=neq=2 equations ? n=2 lags (pure ARCH, not GARCH) ? ? basic multivariate normal likelihood function; ? define the components below ? frml march logl = -.5*log(dets) -.5*eie/dets + con*neq; set con = -.5*log(6.2831853); ? constant term -- log(2*pi) ? set neq = 2; ? ? s.. = sigma matrix ? a.. = constant part of sigma matrix ? b.. = coefficients of first lag ? c.. = coefficients of second lag ? e12 = equation 1, lag 2 -- define this below ? e21 = equation 2, lag 1, etc. ? frml s11 a11 + b11*e11*e11 + c11*e12*e12; frml s21 a21 + b21*e21*e11 + c21*e22*e12; frml s22 a22 + b22*e21*e21 + c22*e22*e22; list se s11 s21 s22; list ap a11 a21 a22; list bp b11 b21 b22; list cp c11 c21 c22; list allp ap bp cp; ? ? i.. = sigma-inverse (times dets) = cofactors ? frml i11 s22; frml i21 -s21; frml i22 s11; list ie i11 i21 i22; ? ? dets = determinant of sigma ? frml dets s11*i11 + s21*i21; ? ? eie = e'(sigma-inverse)*e ? frml eie e1*(e1*i11 + 2*e2*i21) + e2*e2*i22; ? ? simple example of structural equations and their lags ? e12 = equation 1, lag 2 -- define this below ? frml e1 y1-a1-b1*x; frml e11 y1(-1)-a1-b1*x(-1); frml e12 y1(-2)-a1-b1*x(-2); frml e2 y2-a2; frml e21 y2(-1)-a2; frml e22 y2(-2)-a2; list elag0 e1-e2; list e1lags e11-e12; list e2lags e21-e22; param a1-a2 b1; set T = 100; smpl 1,T; ? draw some data for example random(seed=491479) x; random y1; y1 = 1+x+y1; random(mean=2) y2; ? smpl 3,T; lsq e1-e2; ? estimate with LSQ to get Sigma starting values ? param allp; ? sets all covariance parameters to zero eqsub march dets eie ie se elag0 e1lags-e2lags; ? initialize covariance parameters set a11 = @covu(1,1); set a21 = @covu(2,1); set a22 = @covu(2,2); options limnum=9999,limwarn=0; const bp cp; ? hold arch params at zero to start with ml march; param bp; ? allow arch params on first lag to be non-zero if (@ifconv); then; ml march; param cp; ? allow arch params on second lag to be non-zero ? (does not converge on this data, even in 100 iterations) ? (but note that the data-generating parameters are zero) if (@ifconv); then; ml march; stop ; end ;