** Example 10.2: constant correlation coefficient ** all 0 888:1 open data m-ibmspln.dat data(org=obs) / r1 r2 set h1 = 0.0 set h2 = 0.0 nonlin c1 c2 p11 p22 p12 a0 b0 a11 a21 a22 b11 b12 b21 b22 rho frml a1t = r1(t)-c1-p11*r1{1}-p22*r1{2}-p12*r2{2} frml a2t = r2(t)-c2 frml gvar1 = a0+a11*a1t(t-1)**2+b11*h1(t-1)+b12*h2(t-1) frml gvar2 = b0+a21*a1t(t-1)**2+a22*a2t(t-1)**2+b21*h1(t-1)+b22*h2(t-1) frml gdet = -0.5*(log(h1(t)=gvar1(t))+log(h2(t)=gvar2(t))+log(1.0-rho**2)) frml garchln = gdet-0.5/(1.0-rho**2)*((a1t(t)**2/h1(t))+(a2t(t)**2/h2(t)) \$ -2*rho*a1t(t)*a2t(t)/sqrt(h1(t)*h2(t))) smpl 4 888 compute c1 = 1.4, c2 = 0.7, p11 = 0.1, p22 = 0.1, p12 = -0.1 compute a0 = 3.0, a11=0.1, a21=0.02, a22=0.05 compute b0=2.0, b11=.8, b12=.01, b21=.01, b22=.8, rho = 0.1 *maximize(method=simplex,iterations=10) garchln maximize(method=bhhh,recursive,iterations=150) garchln set fv1 = gvar1(t) set resi1 = a1t(t)/sqrt(fv1(t)) set residsq = resi1(t)*resi1(t) *** Checking standardized residuals *** cor(qstats,number=20,span=4) resi1 *** Checking squared standardized residuals *** cor(qstats,number=20,span=4) residsq set fv2 = gvar2(t) set resi2 = a2t(t)/sqrt(fv2(t)) set residsq = resi2(t)*resi2(t) *** Checking standardized residuals *** cor(qstats,number=20,span=4) resi2 *** Checking squared standardized residuals *** cor(qstats,number=20,span=4) residsq *** Last few observations needed for forecasts *** set shock1 = a1t(t) set shock2 = a2t(t) print 885 888 shock1 shock2 fv1 fv2