zfk 发表于 2010-1-16 21:28 
现在想自己写个程序估计GARCH(1,1)模型:
X_t=\sigma_t\epsilon_t,
\sigma_t^2=\alpha_0+\alpha_1X_{t-1}+\beta_1\sigma_{t-1}^2
在给定实际数据进行估计时,我们知道的是X_t , \sigma_t怎么得到???
Here is the proc model in SAS with simulated data.
For more details, please look the link,
http://support.sas.com/rnd/app/examples/ets/garchex/#ets_webex.garchex.garch
%let df = 7.5;
%let sig1 = 1;
%let sig2 = 0.1 ;
%let var2 = 2.5;
%let nobs = 1000 ;
%let nobs2 = 2000 ;
%let arch0 = 0.1 ;
%let arch1 = 0.2 ;
%let garch1 = 0.75 ;
%let intercept = 0.5 ;
data normal;
lu = &var2;
lh = &var2;
do i= -500 to &nobs ;
/* GARCH(1,1) with normally distributed residuals */
h = &arch0 + &arch1*lu**2 + &garch1*lh;
u = sqrt(h) * rannor(12345) ;
y = &intercept + u;
lu = u;
lh = h;
if i > 0 then output;
end;
run;
/* Estimate GARCH(1,1) with normally distributed residuals with MODEL*/
proc model data = normal ;
parms arch0 .1 arch1 .2 garch1 .75 ;
/* mean model */
y = intercept ;
/* variance model */
h.y = arch0 + arch1*xlag(resid.y**2,mse.y) +
garch1*xlag(h.y,mse.y) ;
/* fit the model */
fit y / method = marquardt fiml ;
run ;
quit ;