Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
SAS Macros and Functions

Examples

Suppose the data set TEST contains 104 observations of the time series variable Y, and you want to test the null hypothesis that there exists a lag 4 seasonal unit root in the Y series. The following statements illustrate how to perform the single-mean Dickey-Fuller regression coefficient test using PROC REG and PROBDF.

   data test1;
      set test;
      y4 = lag4(y);
   run; 
   
   proc reg data=test1 outest=alpha;
      model y = y4 / noprint;
   run;
   
   data _null_;
      set alpha;
      x = 100 * ( y4 - 1 );           
      p = probdf( x, 100, 4, 'RSM' );
      put p= pvalue5.3;
   run;

To perform the augmented Dickey-Fuller test, regress the differences of the series on lagged differences and on the lagged value of the series, and compute the test statistic from the regression coefficient for the lagged series. The following statements illustrate how to perform the single-mean augmented Dickey-Fuller studentized test using PROC REG and PROBDF.

   data test1;
      set test;
      yl  = lag(y);
      yd  = dif(y);
      yd1 = lag1(yd); yd2 = lag2(yd);
      yd3 = lag3(yd); yd4 = lag4(yd);
   run; 
   
   proc reg data=test1 outest=alpha covout;
      model yd = yl yd1-yd4 / noprint;
   run;
   
   data _null_;
      set alpha;
      retain a;
      if _type_ = 'PARMS' then a = yl - 1;
      if _type_ = 'COV' & _NAME_ = 'YL' then do;
         x = a / sqrt(yl);
         p = probdf( x, 99, 1, 'SSM' );
         put p= pvalue5.3;
         end;
   run;

The %DFTEST macro provides an easier way to perform Dickey-Fuller tests. The following statements perform the same tests as the preceding example.

   %dftest( test, y, ar=4 );
   %put p=&dftest;

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.