options crt; name egarch 'egarch(1,1) example'; ? Uses ML PROC. ? by Clint Cummins 2/1999 ?-------------------------- ? generate artificial data ?-------------------------- ? Note: if 500 or 1000 observations are used for this particular ? data generation process, the estimates are not very close to ? the true parameter values. smpl 1,2000; trend obs; random(seedin=308130) x e; x = x*2; param a0,1 a1,.3 b1,.3; logh = a0/(1-a1-b1); select obs>1; logh = a0 + a1*abs(e(-1)) + b1*logh(-1); select 1; u = e*exp(logh/2); param g0,1 g1,1; y = g0 + g1*x + u; ?----------------------------------- ? end of artificial data generation ?----------------------------------- supres smpl; ml egarch g0 g1 a0 a1 b1; proc egarch; set lh = a0/(1-a1-b1); if (abs(lh) > 3 .or. a0<=0 .or. (a1+b1)>=1); then; do; set @logl = @miss; goto 900; enddo; u = y - (g0 + g1*x); h = exp(lh); select obs>1; genr(silent) h = exp(a0 + a1*abs(u(-1)/sqrt(h(-1))) + b1*log(h(-1))); select 1; logl = lnorm(u/sqrt(h)) - log(h)/2; mat @logl = sum(logl); 900 nodbug; endproc;