ifallasleepjing 发表于 2010-1-15 10:13 
楼主弄的怎么样了,我最近也在做这个~
想向楼主讨教一下~
Here is the univariate case using simulated data with SAS
%let var2 = 2.5;
%let nobs = 1000 ;
%let arch0 = 0.1 ;
%let arch1 = 0.2 ;
%let garch1 = 0.75 ;
%let intercept = 0.5 ;
data egarch ;
lu = &var2 ;
lh = &var2 ;
theta = .65 ;
lz = lu/sqrt(lh) ;
lg = theta*lz + abs(lz)-sqrt(2/3.14159) ;
do i = -500 to &nobs ;
/* EGARCH */
h = exp( &arch0 + &arch1*lg + &garch1*log(lh)) ;
u = sqrt(h)*rannor(12346) ;
z = u/sqrt(h) ;
g = theta*z + abs(z) -sqrt(2/3.14159) ;
y = &intercept + u ;
lu = u ;
lh = h ;
lg = g ;
if i > 0 then output ;
end ;
run ;
/* Estimate EGARCH Model with PROC AUTOREG */
proc autoreg data= egarch ;
model y = / garch=( q=1, p=1 , type = exp) ;
run;
quit;
/* Estimate EGARCH Model with PROC MODEL */
proc model data = egarch ;
parms earch0 .1 earch1 .2 egarch1 .75 theta .65 ;
/* mean model */
y = intercept ;
/* variance model */
if (_obs_ = 1 ) then
h.y = exp( earch0 + egarch1 * log(mse.y) );
else h.y = exp(earch0 + earch1*zlag(g) + egarch1*log(zlag(h.y))) ;
g = theta*(-nresid.y) + abs(-nresid.y) - sqrt(2/constant('pi')) ;
/* fit the model */
fit y / fiml method = marquardt ;
run;
quit;