I am a bit confused about the three different Augmented Dickey–Fuller tests (none,drift, trend). Based on the Wikipedia page on the topic, those three ADF tests are almost the same in that the unit root test is carried out under the null hypothesis r = 0 against the alternative hypothesis of r < 0 and DF = r/SE(r).
Is the only difference the critical value?
The R function adf.test only uses one type of critical value (with drift and trend). So if my data doesn't have drift and trend, might the output of adf.test be incorrect?
Best Answer
The Wikipedia page states the following:
As you very well note, there are variations of the test, which involve restricting $\alpha$ and/or $\beta$ equal to 0. Imposing the restriction on $\alpha$ corresponds to omitting a constant while restricting $\beta$ corresponds to omitting a time trend.
To understand what you're doing when using the
adf.test()
function from thetseries package
in R, we should first consult the documentation provided by the package authors. To do this, we execute?adf.test
in the R console. Doing this will provide us details about the function; what it does, how we can use it, etc. For present purposes, we just need to be aware that the documentation states:(Do we need more information than that?)
Coupled with that fact, if we look at the usage of the function; namely,
one begins to think that the function has limited capabilities with regard to the restricted variations of the ADF test. Reading all of the documentation seems to make it clear that the function only runs one variation of the test; the unrestricted version, which includes both a constant and a trend.
(Do we need more information than that?)
Since you're using R, we don't have to be left wondering if the function somehow imposes the restrictions internally without us knowing! To really be sure what's going on behind the scenes, we can look at the source code of the
adf.test()
function. Below, I step through the code, which I have shortened, and I hope it's instructive to you.By my count, the
adf.test()
function is, in fact, made up of 57 lines of code, which I encourage you to inspect. The rest of the function code is not important in the context of this question. All that needs to be known is that the function does do what it says on the tin. Importantly, there does not seem to be a high level way of using the function to run a restricted variation of the ADF test and retrieve the associated critical values.What to do? Your first instinct should be to check out the CRAN Task View: Time Series Analysis page. In doing so, you'll learn that the
urca package
provides an alternative implementation of the ADF test. Indeed, as I mentioned in the comments, theur.df()
function should be able to meet your needs. Inspecting the function usage is quite informative!The urca package can be found here and I recommend consulting the package documentation and the source code if you need to. I suspect that you should be able to use the function and not worry about issues regarding critical values; the authors of the package will have taken care of that so you can concentrate on using it as a high-level function and doing your research.
In terms of applying the ADF test (knowing which tests to run and in which order), I would suggest the Dolado et al. procedure. The reference is:
Final note on matching the R code to the mathematical equation. You can basically think of it as follows (strictly speaking, the parameters should be omitted, but...):
yt
= $\Delta y_{t}$xt
= $\gamma y_{t-1}$+ 1
= $\alpha$tt
= $\beta t$yt1
= $\delta_1 \Delta y_{t-1} + \cdots + \delta_{p-1} \Delta y_{t-p+1}$