ARIMA Procedure
Example 7.8 Test for Stationarity
(View the complete code for this example.)
As mentioned in the section The Three Stages of ARIMA Modeling, identification is the first stage of time series modeling. Stationarity tests can help you decide whether to difference; this decision is an important part of identification. If a series is nonstationary, it requires differencing. Dickey (2005) demonstrates how to conduct stationarity tests and how to difference series by using PROC ARIMA. This example follows a similar fashion with two different data generation models.
The following DATA step generates a sample of 100 periods from the ARIMA(1,1,0) process: ,
, and
.
title1 'Simulated ARIMA(1,1,0)';
data a;
u1 = 0;
u2=0;
do i = -50 to 100;
a = rannor( 1234 );
du1 = u1 - u2;
du = 0.6 * du1 + a;
u = du + u1;
if i > 0 then output;
u2 = u1;
u1 = u;
end;
run;
First, you should check the observation and correlation analysis graphs. This not only helps you better understand the data, but it is also needed in order to conduct the augmented Dickey-Fuller (ADF) tests. When conducting the ADF tests, you need to specify how many lagged differences to include in the test regression and which model (zero mean, single mean, or trend) to use. An inappropriate choice can lead to incorrect results. The following statements identify the model and generate observation and correlation graphs:
proc arima data=a;
identify var=u;
run;
The results of the graphical series correlation analysis are shown in Output 7.8.1.
Output 7.8.1: Correlation Analysis for the Nonstationary Series

As shown in Output 7.8.1, there is no obvious time trend in the data, and the mean is not close to zero. An AR(1) model would suffice for the test, because the partial autocorrelation functions (PACFs) decline quickly after the first lag, as shown in the PACF plot. The ADF= option in ADF tests should be set to 0 here, because zero lagged differences are used in the test regression for the AR(1) model. However, to better illustrate how the ADF= and PP= options work, they are set to 1 in this example. The following PROC ARIMA statements conduct stationarity tests:
proc arima data=a;
identify var=u stationarity=(adf=1);
run;
identify var=u stationarity=(pp=1);
run;
quit;
The first IDENTIFY statement performs the ADF unit root tests for the original series, u. The descriptive statistics and stationarity test results are shown in Output 7.8.2.
Output 7.8.2: Descriptive Statistics and ADF Tests for the Nonstationary Series
| Simulated ARIMA(1,1,0) |
| Name of Variable = u | |
|---|---|
| Mean of Working Series | 7.033652 |
| Standard Deviation | 7.81187 |
| Number of Observations | 100 |
| Augmented Dickey-Fuller Unit Root Tests | |||||||
|---|---|---|---|---|---|---|---|
| Type | Lags | Rho | Pr < Rho | Tau | Pr < Tau | F | Pr > F |
| Zero Mean | 0 | 2.0617 | 0.9892 | 1.66 | 0.9758 | ||
| 1 | -1.0989 | 0.4543 | -0.39 | 0.5405 | |||
| Single Mean | 0 | 0.9908 | 0.9879 | 0.59 | 0.9889 | 1.83 | 0.6090 |
| 1 | -4.0438 | 0.5273 | -1.08 | 0.7209 | 0.80 | 0.8684 | |
| Trend | 0 | 0.1327 | 0.9964 | 0.08 | 0.9967 | 1.32 | 0.9121 |
| 1 | -5.3582 | 0.7871 | -1.43 | 0.8471 | 1.50 | 0.8767 | |
The three types of models are listed in the Type column in the "Augmented Dickey-Fuller Unit Root Tests" table in Output 7.8.2. The single-mean model fits best in this case, because the mean is not zero, as shown in Output 7.8.2, and there is no obvious time trend, as demonstrated in the observation plot in Output 7.8.1.
For each type of model, two rows of test statistics are reported: 0 lags and 1 lag. This is set by the ADF=1 option in the STATIONARITY= option. The row of 0 lags shows test statistics for an AR(1) model, where zero lagged differences are used in the test regression. The row of 1 lag shows test statistics for the AR(2) model, where one lagged differenced term is used in the test regression. As mentioned earlier, an AR(1) model would suffice in this case.
All three kinds of test statistics are reported under the ADF tests, as presented in Output 7.8.2. Tau test statistics are mostly used to decide whether to reject the null hypothesis. The p-values of the tau test statistics in both the AR(1) and AR(2) models are greater than 0.1, and the null hypothesis (the series is nonstationary; that is, there is a unit root) cannot be rejected at the 10% level.
The second IDENTIFY statement performs the Phillips-Perron (PP) tests for the original series, u. The stationarity test results are shown in Output 7.8.3.
Output 7.8.3: PP Tests for the Nonstationary Series
| Phillips-Perron Unit Root Tests | |||||
|---|---|---|---|---|---|
| Type | Lags | Rho | Pr < Rho | Tau | Pr < Tau |
| Zero Mean | 0 | 2.0617 | 0.9892 | 1.66 | 0.9758 |
| 1 | 1.5957 | 0.9715 | 1.01 | 0.9169 | |
| Single Mean | 0 | 0.9908 | 0.9879 | 0.59 | 0.9889 |
| 1 | 0.1542 | 0.9632 | 0.07 | 0.9618 | |
| Trend | 0 | 0.1327 | 0.9964 | 0.08 | 0.9967 |
| 1 | -0.7639 | 0.9901 | -0.35 | 0.9881 | |
The output structure of the PP tests is similar to that of the ADF tests, except that there is no F test. The PP tests also report the rho test statistic (shown in the Rho column) and the tau test statistic (shown in the Tau column), but they are calculated differently from the ADF tests. As shown in Output 7.8.3, the p-values of the tau test statistics are greater than 0.1, and therefore the PP tests also fail to reject the null hypothesis that the series is nonstationary.
The preceding results of the stationarity tests are consistent with the correlation analysis output. As shown in Output 7.8.1, the ACFs are significant and decay very slowly with increasing lag. This also suggests nonstationarity. Note that the estimated partial autocorrelation for the first lag is close to 1 and the PACFs decline quickly after the first lag. This suggests that you should consider differencing the series. The following statements identify the differenced series, :
proc arima data=a;
identify var=u(1);
run;
The results of the graphical series correlation analysis are shown in Output 7.8.4.
Output 7.8.4: Correlation Analysis for the Differenced Series

The series also presents no trend and moves around 0, as shown in Output 7.8.4. As in the original series, the PACFs decline quickly after the first lag, suggesting an AR(1) model. Therefore, the stationarity tests are conducted with zero lagged differences, as in the following statements:
proc arima data=a;
identify var=u(1) stationarity=(adf=0);
run;
identify var=u(1) stationarity=(pp=0);
run;
quit;
The descriptive statistics and ADF test results are shown in Output 7.8.5. The PP test results are shown in Output 7.8.6.
Output 7.8.5: Descriptive Statistics and ADF Tests for the Differenced Series
| Simulated ARIMA(1,1,0) |
| Name of Variable = u | |
|---|---|
| Period(s) of Differencing | 1 |
| Mean of Working Series | 0.235092 |
| Standard Deviation | 1.275033 |
| Number of Observations | 99 |
| Observation(s) eliminated by differencing | 1 |
| Dickey-Fuller Unit Root Tests | |||||||
|---|---|---|---|---|---|---|---|
| Type | Lags | Rho | Pr < Rho | Tau | Pr < Tau | F | Pr > F |
| Zero Mean | 0 | -36.1794 | <.0001 | -4.75 | <.0001 | ||
| Single Mean | 0 | -37.1317 | 0.0009 | -4.77 | 0.0002 | 11.42 | 0.0010 |
| Trend | 0 | -38.5203 | 0.0005 | -4.87 | 0.0007 | 11.87 | 0.0010 |
Output 7.8.6: PP Tests for the Differenced Series
| Phillips-Perron Unit Root Tests | |||||
|---|---|---|---|---|---|
| Type | Lags | Rho | Pr < Rho | Tau | Pr < Tau |
| Zero Mean | 0 | -36.1794 | <.0001 | -4.75 | <.0001 |
| Single Mean | 0 | -37.1317 | 0.0009 | -4.77 | 0.0002 |
| Trend | 0 | -38.5203 | 0.0005 | -4.87 | 0.0007 |
As indicated in Output 7.8.5, the mean of the differenced series is very close to 0, as is also suggested by Output 7.8.4. Therefore, you should look at the test statistics for the zero-mean model. You can also look at the single-mean model if you are not sure about the mean. The first IDENTIFY statement performs the ADF tests, and the second IDENTIFY statement performs the PP tests for the differenced series. Based on the p-values of both tests, the null hypothesis is rejected at the 1% level, indicating that the differenced series is stationary.
The preceding example demonstrates a nonstationary process that is stationary after first differencing. The next example demonstrates the unit root tests of a trend series that is composed of a time trend and a stationary part. The following DATA step generates a sample of 100 periods from the process: ,
.
title 'Simulated Trend Series with a Stationary AR(1) Process';
data b;
u1 = -20;
do i = -50 to 100;
a = rannor( 1234 );
u = 2*i + 0.5*u1 + a;
if i > 0 then output;
u1 = u;
end;
run;
As in the previous example, you first identify the model and check the observation and correlation graphs by using the following statements:
proc arima data=b;
identify var=u;
run;
The results of the graphical series correlation analysis are shown in Output 7.8.7.
Output 7.8.7: Correlation Analysis for a Trend Series with a Stationary Part

As shown in the observation plot in Output 7.8.7, the series has an obvious time trend. From the ACF and PACF plots in Output 7.8.7, you could conclude that it should be an AR(1) process, because the ACF does not decline as much as the lag increases and the PACF shows only one significant lag. The ADF=0 and PP=0 options should be specified in the stationarity tests, as in the following statements:
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.
Output 7.8.8: ADF Tests for a Trend Series with a Stationary Part
| Simulated Trend Series with a Stationary AR(1) Process |
| Dickey-Fuller Unit Root Tests | |||||||
|---|---|---|---|---|---|---|---|
| Type | Lags | Rho | Pr < Rho | Tau | Pr < Tau | F | Pr > F |
| Zero Mean | 0 | 1.4988 | 0.9653 | 14.74 | 0.9999 | ||
| Single Mean | 0 | -0.0036 | 0.9557 | -0.04 | 0.9523 | 597.85 | 0.0010 |
| Trend | 0 | -47.5985 | 0.0003 | -5.52 | <.0001 | 15.22 | 0.0010 |
As mentioned earlier, there is a trend in the data, and the "Trend" type in Output 7.8.8 should be the focus here. As shown in Output 7.8.8, the p-value of the tau test statistic for AR(1) (that is, the LAG=0 case) is less than 0.0001, indicating that the null hypothesis (nonstationarity) is rejected and the series is trend stationary. The p-value of the F test statistic is 0.001. This means that the joint test of time trend and nonstationarity is rejected at the 1% level. Note that a random walk process with a positive drift would have plots very similar to those in this case, but both the tau test and the F test would fail to reject the null hypothesis (nonstationarity) for a random-walk-with-drift process. The number of lagged differences in the test regression is important. In this particular case, when the model includes more than 12 lags of differenced terms, the p-values of the tau test statistics are greater than 0.15 and the null hypothesis cannot be rejected at the 10% level. To conduct valid ADF tests, you need to select the autocorrelations first. The PP tests correct the statistics for autocorrelations and do not require you to select the autocorrelations. The second IDENTIFY statement in the preceding code performs the PP tests for u. The stationarity test results are shown in Output 7.8.9.
Output 7.8.9: PP Tests for a Trend Series with a Stationary Part
| Phillips-Perron Unit Root Tests | |||||
|---|---|---|---|---|---|
| Type | Lags | Rho | Pr < Rho | Tau | Pr < Tau |
| Zero Mean | 0 | 1.4988 | 0.9653 | 14.74 | 0.9999 |
| Single Mean | 0 | -0.0036 | 0.9557 | -0.04 | 0.9523 |
| Trend | 0 | -47.5985 | 0.0003 | -5.52 | <.0001 |
As shown in Output 7.8.9, the p-value of the tau test statistic under the trend type is less than 0.001. If you include many lagged differences here, you will find that the p-values of the tau test statistic under the trend type are still less than 0.001. The PP tests reject the null hypothesis of nonstationarity with all the different levels of autocorrelation. As a trade-off, the PP tests work well only in large samples.