Sas stationary test 방법 adf

Skip to content

To determine if a time series is stationary or has the unit root, three methods can be used:

A. The most intuitive way, which is also sufficient in most cases, is to eyeball the ACF (Autocorrelation Function) plot of the time series. The ACF pattern with a fast decay might imply a stationary series.
B. Statistical tests for Unit Roots, e.g. ADF (Augmented Dickey–Fuller) or PP (Phillips–Perron) test, could be employed as well. With the Null Hypothesis of Unit Root, a statistically significant outcome might suggest a stationary series.
C. In addition to the aforementioned tests for Unit Roots, statistical tests for stationarity, e.g. KPSS (Kwiatkowski–Phillips–Schmidt–Shin) test, might be an useful complement as well. With the Null Hypothesis of stationarity, a statistically insignificant outcome might suggest a stationary series.

By testing both the unit root and stationarity, the analyst should be able to have a better understanding about the data nature of a specific time series.

The SAS macro below is a convenient wrapper of stationarity tests for many time series in the production environment. (Please note that this macro only works for SAS 9.2 or above.)

%macro stationary(data = , vars =); ***********************************************************; * THIS SAS MACRO IS TO DO STATIONARITY TESTS FOR MANY *; * TIME SERIES *; * ------------------------------------------------------- *; * INPUT PARAMETERS: *; * DATA: A INPUT SAS DATASET *; * VARS: A LIST OF TIME SERIES *; * ------------------------------------------------------- *; * AUTHOR: *; ***********************************************************; options nocenter nonumber nodate mprint mlogic symbolgen orientation = landscape ls = 150 formchar = "|----|+|---+=|-/\<>*"; %local sig loop; %let sig = 0.1; %let loop = 1; %do %while (%scan(&vars, &loop) ne %str()); %let x = %scan(&vars, &loop); proc sql noprint; select int(12 * ((count(&x) / 100) ** 0.25)) into :nlag1 from &data; select int(max(1, (count(&x) ** 0.5) / 5)) into :nlag2 from &data; quit; ods listing close; ods output kpss = _kpss (drop = model lags rename = (prob = probeta)) adf = _adf (drop = model lags rho probrho fstat probf rename = (tau = adf_tau probtau = adf_probtau)) philperron = _pp (drop = model lags rho probrho rename = (tau = pp_tau probtau = pp_probtau)); proc autoreg data = &data; model &x = / noint stationarity = (adf = &nlag1, phillips = &nlag2, kpss = (kernel = nw lag = &nlag1)); run; quit; ods listing; proc sql noprint; create table _1 as select upcase("&x") as vars length = 32, upcase(_adf.type) as type, _adf.adf_tau, _adf.adf_probtau, _pp.pp_tau, _pp.pp_probtau, _kpss.eta, _kpss.probeta, case when _adf.adf_probtau < &sig or _pp.pp_probtau < &sig or _kpss.probeta > &sig then "*" else " " end as _flg, &loop as _i, monotonic() as _j from _adf inner join _pp on _adf.type = _pp.type inner join _kpss on _adf.type = _kpss.type; quit; %if &loop = 1 %then %do; data _result; set _1; run; %end; %else %do; proc append base = _result data = _1; run; %end; proc datasets library = work nolist; delete _1 _adf _pp _kpss / memtype = data; quit; %let loop = %eval(&loop + 1); %end; proc sort data = _result; by _i _j; run; proc report data = _result box spacing = 1 split = "/" nowd; column("STATISTICAL TESTS FOR STATIONARITY/ " vars type adf_tau adf_probtau pp_tau pp_probtau eta probeta _flg); define vars / "VARIABLES/ " width = 20 group order order = data; define type / "TYPE/ " width = 15 order order = data; define adf_tau / "ADF TEST/FOR/UNIT ROOT" width = 10 format = 8.2; define adf_probtau / "P-VALUE/FOR/ADF TEST" width = 10 format = 8.4 center; define pp_tau / "PP TEST/FOR/UNIT ROOT" width = 10 format = 8.2; define pp_probtau / "P-VALUE/FOR/PP TEST" width = 10 format = 8.4 center; define eta / "KPSS TEST/FOR/STATIONARY" width = 10 format = 8.2; define probeta / "P-VALUE/FOR/KPSS TEST" width = 10 format = 8.4 center; define _flg / "STATIONARY/FLAG" width = 10 center; run; %mend stationary;

$\begingroup$

The SAS System 14:11 Thursday, October 6, 2013 1 The ARIMA Procedure Name of Variable = ln_G_S_Index Period(s) of Differencing 1 Mean of Working Series 0.094293 Standard Deviation 0.316757 Number of Observations 15 Observation(s) eliminated by differencing 1 Autocorrelations Lag Covariance Correlation -1 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1 Std Error 0 0.100335 1.00000 | |********************| 0 1 0.0026693 0.02660 | . |* . | 0.258199 2 -0.018517 -.18456 | . ****| . | 0.258382 3 0.029440 0.29342 | . |****** . | 0.267025 "." marks two standard errors Inverse Autocorrelations Lag Correlation -1 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1 1 -0.14763 | . ***| . | 2 0.19526 | . |**** . | 3 -0.27516 | . ******| . | Partial Autocorrelations Lag Correlation -1 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1 1 0.02660 | . |* . | 2 -0.18539 | . ****| . | 3 0.31522 | . |****** . | Phillips-Perron Unit Root Tests Type Lags Rho Pr < Rho Tau Pr < Tau Zero Mean 0 -11.6883 0.0066 -3.23 0.0033 1 -11.4504 0.0074 -3.23 0.0034 Single Mean 0 -13.7527 0.0129 -3.71 0.0171 1 -12.6667 0.0218 -3.76 0.0157 Trend 0 -14.5288 0.0601 -3.25 0.1144 1 -13.1531 0.1022 -3.20 0.1239 The SAS System 14:11 Thursday, October 6, 2013 2 The ARIMA Procedure Name of Variable = ln_G_S_Index Period(s) of Differencing 1 Mean of Working Series 0.094293 Standard Deviation 0.316757 Number of Observations 15 Observation(s) eliminated by differencing 1 Autocorrelations Lag Covariance Correlation -1 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1 Std Error 0 0.100335 1.00000 | |********************| 0 1 0.0026693 0.02660 | . |* . | 0.258199 2 -0.018517 -.18456 | . ****| . | 0.258382 3 0.029440 0.29342 | . |****** . | 0.267025 "." marks two standard errors Inverse Autocorrelations Lag Correlation -1 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1 1 -0.14763 | . ***| . | 2 0.19526 | . |**** . | 3 -0.27516 | . ******| . | Partial Autocorrelations Lag Correlation -1 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1 1 0.02660 | . |* . | 2 -0.18539 | . ****| . | 3 0.31522 | . |****** . | Augmented Dickey-Fuller Unit Root Tests Type Lags Rho Pr < Rho Tau Pr < Tau F Pr > F Zero Mean 0 -11.6883 0.0066 -3.23 0.0033 1 -12.4302 0.0041 -2.42 0.0197 Single Mean 0 -13.7527 0.0129 -3.71 0.0171 6.91 0.0157 1 -25.2133 <.0001 -3.63 0.0214 6.59 0.0206 Trend 0 -14.5288 0.0601 -3.25 0.1144 6.44 0.0799 1 -45.0252 <.0001 -3.20 0.1265 6.92 0.0622 The SAS System 14:11 Thursday, October 6, 2013 3

chl

51.7k19 gold badges210 silver badges370 bronze badges

asked Oct 28, 2013 at 5:34

$\endgroup$

3

$\begingroup$

Look at the ADF Unit Root Test section.

If your data is a random walk with drift, then it will be under the type 'Single Mean'.

For the ADF test, H0: Non-stationary Ha: Stationary

if P-value < 0.05, you reject the null hypo (H0) and conclude that data series is stationary. It should be as you already differenced the data once.

Under 'Pr < Rho' which stands for the P-value of your Rho (autocorrelation), it is 0.0129 and <0.0001 thus, we reject the null hypo and conclude that the data is stationary.

answered Nov 4, 2013 at 3:44

$\endgroup$

1

How do you check stationarity in SAS?

proc arima data=b; identify var=u stationarity=(adf=0); run; identify var=u stationarity=(pp=0); run; quit; The first IDENTIFY statement performs the ADF unit root tests for u. The stationarity test results are shown in Output 7.8. 8.

What is the difference between KPSS and ADF test?

So in summary, the ADF test has an alternate hypothesis of linear or difference stationary, while the KPSS test identifies trend-stationarity in a series.

What is the difference between ADF test and PP test?

Though the PP unit root test is similar to the ADF test, the primary difference is in how the tests each manage serial correlation. Where the PP test ignores any serial correlation, the ADF uses a parametric autoregression to approximate the structure of errors.

How do you interpret the results of ADF?

The augmented Dickey–Fuller (ADF) statistic, used in the test, is a negative number. The more negative it is, the stronger the rejection of the hypothesis that there is a unit root at some level of confidence.

Toplist

최신 우편물

태그