사이트맵  |  Contact Us
 
홈 > SAS Stories > SAS 질문과 답변
[도움말발췌]시계열 분석에 관한 질문입니다. 2010.04.29
권용관 6324 0
http://www.mysas.co.kr/sas_club/b_answer.asp?b_no=1329&gotopage=117&con=subject&keyword=&cmd=content&bd_no=6&gubun=

안녕하세요.

제가 이론적인 부분을 잘 몰라서 일단 SAS도움말만 좀 찾아봤습니다. 부디 도움이 되시길.ㅠㅠ


Example 30.3: Numerous Examples

 /* Data 'a' Generated Process */
   proc iml;
      sig = {1.0  0.5, 0.5  1.25};
      phi = {1.2 -0.5, 0.6  0.3};
      call varmasim(y,phi) sigma = sig n = 100 seed = 46859;   
      cn = {'y1' 'y2'};
      create a from y[colname=cn];
      append from y;
   quit;
 
 /* when the series has a linear trend */
   proc varmax data=a;
      model y1 y2 / p=1 trend=linear;
   run;
 
 /* Fit subset of AR order 1 and 3 */
   proc varmax data=a;
      model y1 y2 / p=(1,3);
   run;
   
 /* Check if the series is nonstationary */
   proc varmax data=a;
      model y1 y2 / p=1 dftest print=(roots);
   run;
   
 /* Fit VAR(1) in differencing */
   proc varmax data=a;
      model y1 y2 / p=1 print=(roots) dify=(1);
   run;
   
 /* Fit VAR(1) in seasonal differencing */
   proc varmax data=a;
      model y1 y2 / p=1 dify=(4) lagmax=5;
   run;
 
 /* Fit VAR(1) in both regular and seasonal differencing */
   proc varmax data=a;
      model y1 y2 / p=1 dify=(1,4) lagmax=5;
   run;
 
 /* Fit VAR(1) in different differencing */
   proc varmax data=a;
      model y1 y2 / p=1 dif=(y1(1,4) y2(1)) lagmax=5;
   run;
 
 /* Options related prediction */
   proc varmax data=a;
      model y1 y2 / p=1 lagmax=3
                    print=(impulse covpe(5) decompose(5));
   run;
 
 /* Options related tentative order selection */
   proc varmax data=a;
      model y1 y2 / p=1 lagmax=5 minic
                    print=(parcoef pcancorr pcorr);
   run;
 
 /* Automatic selection of the AR order */
   proc varmax data=a;
      model y1 y2 / minic=(type=aic p=5);
   run;
 
 /* Compare results of LS and Yule-Walker Estimator */
   proc varmax data=a;
      model y1 y2 / p=1 print=(yw);
   run;
 
 /* BVAR(1) of the nonstationary series y1 and y2 */
   proc varmax data=a;
      model y1 y2 / p=1 
         prior=(lambda=1 theta=0.2 ivar nrep=200);
   run;
 
 /* BVAR(1) of the nonstationary series y1 */
   proc varmax data=a;
      model y1 y2 / p=1 
         prior=(lambda=0.1 theta=0.15 ivar=(y1) seed=12345);
   run;
 
 /* Data 'b' Generated Process */
   proc iml;
      sig = { 0.5  0.14 -0.08 -0.03,  0.14 0.71 0.16 0.1,
             -0.08 0.16  0.65  0.23, -0.03 0.1  0.23 0.16};
      sig = sig * 0.0001;
      phi = {1.2 -0.5 0.  0.1,  0.6 0.3 -0.2  0.5, 
             0.4  0. -0.2 0.1, -1.0 0.2  0.7 -0.2};
      call varmasim(y,phi) sigma = sig n = 100 seed = 32567;   
      cn = {'y1' 'y2' 'y3' 'y4'};
      create b from y[colname=cn];
      append from y;
   quit;
 
 /* Cointegration Rank Test using Trace statistics */
   proc varmax data=b;
      model y1-y4 / p=2 lagmax=4 cointtest;
   run;
 
 /* Cointegration Rank Test using Max statistics */
   proc varmax data=b;
      model y1-y4 / p=2 lagmax=4 cointtest=(johansen=(type=max));
   run;
 
 /* Common Trends Test using Filter(Differencing) statistics */
   proc varmax data=b;
      model y1-y4 / p=2 lagmax=4 cointtest=(sw);
   run;
 
 /* Common Trends Test using Filter(Residual) statistics */
   proc varmax data=b;
      model y1-y4 / p=2 lagmax=4 cointtest=(sw=(type=filtres lag=1));
   run;
   
 /* Common Trends Test using Kernel statistics */
   proc varmax data=b;
      model y1-y4 / p=2 lagmax=4 cointtest=(sw=(type=kernel lag=1));
   run;
 
 /* Cointegration Rank Test for I(2) */
   proc varmax data=b;
      model y1-y4 / p=2 lagmax=4 cointtest=(johansen=(iorder=2));
   run;
   
 /* Fit VECM(2) with rank=3 */
   proc varmax data=b;
      model y1-y4 / p=2 lagmax=4 print=(roots iarr) 
                    ecm=(rank=3 normalize=y1); 
   run;


 
 /* Weak Exogenous Testing for each variable */
   proc varmax data=b outstat=bbb;
      model y1-y4 / p=2 lagmax=4  
                    ecm=(rank=3 normalize=y1); 
      cointeg rank=3 exogeneity;
   run;
 
 /* Hypotheses Testing for long-run and adjustment parameter */
   proc varmax data=b outstat=bbb;
      model y1-y4 / p=2 lagmax=4  
                    ecm=(rank=3 normalize=y1); 
      cointeg rank=3 normalize=y1 
         h=(1 0 0, 0 1 0, -1 0 0, 0 0 1)
         j=(1 0 0, 0 1 0, 0 0 1, 0 0 0);
   run;
 
 /* ordinary regression model */
   proc varmax data=grunfeld;
      model y1 y2 = x1-x3;
   run;
 
 /* Ordinary regression model with subset lagged terms */
   proc varmax data=grunfeld;
      model y1 y2 = x1 / xlag=(1,3);
   run;
   
 /* VARX(1,1) with no current time Exogenous Variables */
   proc varmax data=grunfeld;
      model y1 y2 = x1 / p=1 xlag=1 nocurrentx;
   run;
 
 /* VARX(1,1) with different Exogenous Variables */
   proc varmax data=grunfeld;
      model y1 = x3, y2 = x1 x2 / p=1 xlag=1;
   run;
   
 /* VARX(1,2) in difference with current Exogenous Variables */
   proc varmax data=grunfeld;
      model y1 y2 = x1 / p=1 xlag=2 difx=(1) dify=(1);
   run;


Example 30.4: Illustration of ODS Graphics (Experimental)

   ods html;
   ods graphics on;

   title "Illustration of ODS Graphics";
   proc varmax data=sashelp.workers;
      id date interval=month;
      model electric masonry / dify=(1,12) noint p=1;
      output lead=12;
   run;

   ods graphics off;
   ods html close;
 

 



---------------------------------------[ 원 문 ]---------------------------------------

 

1. 자기상관계수와 교차상관계수를 구하려면 어떻게 해야하는지 궁금합니다.

2. VAR(벡터자기회귀모형)을 사용하여 분석하기 위해서는 VARMAX 프로시저를 사용한다고 들었는데,

자세한 사용방법을 모르겠습니다.

   구체적으로 자료의 안정성을 측정하기 위하여 (1) 단위근을 검정할 것이고, 그 다음 (2) AIC, SIC 등을 통하여 최적시차를 결정한 다음,

   (3) 그랜저 인과관계를 검정할 것이고, (4) VAR모형을 사용할 것입니다.

  각 과정을 어떻게 프로그래밍 해야할지 잘 모르겠습니다.

  시중의 책을 찾아봐도 시계열에 관한 SAS책은 거의 없더군요 ㅠ_ㅠ

 
 
 
휴대폰 번호
휴대폰 인증번호
 
 [펌자료]시계열 분석에 관한 질문입니다.
 질문입니다. glimmix procedure 의 parameter estimate 저장법 좀 알려주세요