楼主: bobguy
5283 2

[原创博文] Garch model with nlmixed [推广有奖]

学科带头人

7%

还不是VIP/贵宾

-

威望
0
论坛币
14187 个
通用积分
28.9279
学术水平
344 点
热心指数
363 点
信用等级
228 点
经验
104882 点
帖子
1846
精华
0
在线时间
1608 小时
注册时间
2008-7-18
最后登录
2019-3-8

中级热心勋章

楼主
bobguy 发表于 2011-3-20 12:02:03 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
See at the bottom.

The first and second are provided by SAS.


/*-----------------------------------------------------------------
     Example: Estimating GARCH Models
     Requires: SAS/ETS
     Version: 9.0                                                                       
     ------------------------------------------------------------------*/

   %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;


   proc autoreg data = normal ;
    /* Estimate GARCH(1,1) with normally distributed residuals with AUTOREG*/  
      model y = / garch = ( q=1,p=1 ) ;
   run ;
   quit ;

   
    /* 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,0) +
             garch1*xlag(h.y,0) ;
       /* fit the model */
       fit y / method = marquardt fiml ;
   run ;
   quit ;

     
    /* Estimate GARCH(1,1) with normally distributed residuals with NLMIXED*/   
   proc nlmixed data = normal ;
       /* error mean model */
       err=y-intercept ;
       /* variance model */
       h = arch0 + arch1*xlag(err**2,0) +
             garch1*xlag(h,0) ;
       loglik=-0.5*(log(2*constant('pi'))+log(h)+err**2/h);
      model err ~ general (loglik) ;
   run ;
   quit ;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:nlmixed GARCH Mixed model ARCH provided second

沙发
salutetoc 发表于 2012-3-8 20:30:27
多谢楼主分享经验!

藤椅
鹿丸00 发表于 2012-4-30 14:58:19
多谢,学习了

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-9 10:38