Running a unit root (Dickey-Fuller) and stationarity test on a time series with XLSTAT
Unit root and Stationarity tests
A time series Yt (t=1,2...) is said to be stationary (in the week sense) if its statistical properties do not vary with time (expectation, variance, autocorrelation). The white noise is an example of a stationary time series, with for example the case where Yt follows a normal distribution N(µ,s²) independent of t.
Identifying that a series is not stationary allows to afterwards study where the non-stationarity comes from. A non-stationary series can, for example, be stationary in difference: Yt is not stationary, but the Yt - Yt-1 difference is stationary. It is the case of the random walk. A series can also be stationary in trend.
Stationarity tests allow verifying whether a series is stationary or not. There are two different approaches: some tests consider as null hypothesis H0 that the series is stationary (KPSS test, Leybourne and McCabe test), and for other tests, on the opposite, the null hypothesis is on the contrary that the series is not stationary (Dickey-Fuller test, augmented Dickey-Fuller test, Phillips-Perron test, DF-GLS test). XLSTAT includes as of today the Dickey-Fuller test, the Augmented Dickey-Fuller test (ADF) and the KPSS test.
An Excel sheet with both the data and the results can be downloaded by clicking here. The data have been generated using a random N(0, 1) normal sample of 100 observations (series N), a stationary series built from that sample (series rho =0.8), an autocorrelated series (rho=1) and an explosive time series (rho=1.1), and a series that varies linearly with the time (N-0.1t).
Setting up the ADF and KPSS tests on a time series
After opening XLSTAT, select the XLSTAT / XLSTAT-Time / Unit root and stationarity tests command, or click on the corresponding button of the "XLSTAT-Time" toolbar (see below).
Once you've clicked on the button, the dialog box will appear. Select the data on the Excel sheet. In the “Time series” fieldselect the first and second time series.
The option Series labels is activated because the first row of the selected data contains the header of the variable. The “Stationary” option is selected for the Augmented Dickey Fuller test. The Level option is chosen for the KPSS test.
The computations begin once you have clicked the OK button. The computations last a few seconds as Monte Carlo simulations are performed to obtain precise critical and p-values. While most software use interpolated values, XLSTAT results are based on a high number of Monte Carlo simulations and are more precise. The results of the test will then be displayed.
Interpreting the results of a Dickey-Fuller test and a KPSS test (example on stationary series)
After the summary statistics of the two selected series, the results of the Dickey-Fuller and KPSS tests are displayed for the first, and then for the second series (see sheet Dickey-Fuller|KPSS – 1).
We can see that the two tests agree for these series. For the first series, the Dickey-Fuller rejects the null hypothesis that the series is autocorrelated with (r=1) and retains the alternative hypothesis that it is stationary, and the KPSS test keeps the null hypothesis that the series is stationary.
For the second series (see from Cell 69 and below), the p-values are not as low (ADF test) or high (KPSS test) as it was with the first sample.
Interpreting the results of a Dickey-Fuller test and a KPSS test (example on non-stationary series)
We then run the tests on columns E and F (see results on sheet Dickey-Fuller|KPSS – 2). We change the alternative option to explosive for the Dickey-Fuller test and to trend for the KPSS test. For the first series, the ADF test not does reject the fact that the there is a unit root and the KPSS test rejects the null hypothesis that the series is stationary, even . Both tests perform well on that sample.
For the second series both tests lead to the conclusion that the series is not stationary. The ADF test is more precise as the alternative hypothesis specifies the series is explosive which is obvious when looking at the data.
Interpreting the results of a Dickey-Fuller test and a KPSS test (example on a linear trend series)
Last, we run the tests on the series that varies with time (see results on sheet Dickey-Fuller|KPSS – 3). The ADF test cannot reject the null hypothesis of a unit root because we chose the "explosive" option. If the stationary option had been selected, the null hypothesis would have been rejected because the ADF test automatically removes a linear trend. The “Trend” version of the KPSS test keeps the null hypothesis that the series is stationary, once the trend is removed.
Click here for other tutorials.