?=================================================================== ? 4 step estimator for ARCH model ?=================================================================== ? User must change the next two commands. ? Define the RHS variables NAMELIST ; .... define X $ ? Define the dependent variable. CREATE ; y = ... $ ?=================================================================== ? The initial regression is based on all observations ? Pick up symbolic name for T+1 SAMPLE ; All $ CALCULATE ; T1 = N ; T = T1 - 1 $ ? Least squares estimates at first step are consistent. ? Retrieve initial estimate of rho REGRESS ; Lhs = y ; Rhs = X ; Res = e $ MATRIX ; b0 = b $ ? Set up for initial estimate of à, use OLS, and retrieve SAMPLE ; 2 - T1 $ CREATE ; u = e ^ 2 ; u1 = e[-1] ^ 2 $ NAMELIST ; Z = one,u1 $ REGRESS ; Lhs = u ; Rhs = Z ; keep = ht $ MATRIX ; a0 = b $ ? Variables for second round estimate of à. Regression computes ? an update to estimate of à. Do OLS, then update à. At this ? point, we have the final estimate of à, so use STAT to display. CREATE ; zstar1=1/ht ; zstar2=u1/ht ; ustar=u/ht-1 $ REGRESS ; Lhs = ustar ; Rhs = zstar1,zstar2 $ MATRIX ; alpha = b & a0 ; va=varb ; stat(alpha,va) $ ? Lagrange multiplier test of ARCH specification CALCULATE ; lmtest = N * rsqrd ; chi(lmtest,1) $ ? Now, compute variables for updating regression for alpha CREATE ; hstar = alpha(1) + alpha(2) * u1 $ SAMPLE ; 2 - T$ CREATE ; rt = (1/hstar + 2*e*alpha(2)/hstar[+1]^2)^.5 ; st = 1/hstar-alpha(2)/hstar[+1]^2 *(e[+1]^2-hstar[+1]) ; v = e * st / rt^2 ; rsq = rt^2 $ ? Last regression, for update to current estimate of beta REGRESS ; Lhs = v ; Rhs = X ; WTS = rsq $ MATRIX ; beta = b0 & b ; stat(beta,varb) $ ? The following lines may be omitted. ? If iterations are desired, MATRIX ; b0 = beta $ SAMPLE ; All $ CREATE ; e = y - dot(X,b0) $ ? and, now loop back to `Set up for initial ... above.