怎么用SAS编写ADF单位根检验,

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/30 14:38:02
怎么用SAS编写ADF单位根检验,

怎么用SAS编写ADF单位根检验,
怎么用SAS编写ADF单位根检验,

怎么用SAS编写ADF单位根检验,
先对原时间序列数据进行处理,然后利用reg过程求出回归参数t检验对应的t值,然后与ADF检验的临界值(-2.902358,在显著性水平为0.05的情况下)进行比较.示例程序如下:
data simulation;
do i=1 to 100;
x=rannor(1234);
output;
end;
run;
data timeseries;
set simulation;
x_1st_lag= lag1(x);
x_1st_diff= dif1(x);
x_1st_diff_1st_lag= dif1(lag1(x));
x_1st_diff_2nd_lag= dif1(lag2(x));
x_1st_diff_3rd_lag= dif1(lag3(x));
x_1st_diff_4th_lag= dif1(lag4(x));
x_1st_diff_5th_lag= dif1(lag5(x));
run;
ods output parameterestimates=est(where=(variable="x_1st_lag") keep=variable tvalue);
ods select none;
proc reg data=timeseries;
model x_1st_diff= x_1st_lag
x_1st_diff_1st_lag
x_1st_diff_2nd_lag
x_1st_diff_3rd_lag
x_1st_diff_4th_lag
x_1st_diff_5th_lag;
run;
quit;
ods select all;
ods output close;
data _null_;
file print;
if _n_=1 then do;
put @20"Augmented Dickey-Fuller(ADF) Test for Stationary at level 5%";
put @20"5% level Critical Values = -2.902358 ,level with 5 lags";
end;
set est;
if tvalue gt -2.902358 then
put / @20 "The x series is a non-stationary process when tested at level 5%";
else
put / @20 "The x series is a stationary process when tested at level 5%";
run;