The Augmented Dickey-Fuller test is used to check whether a series has any detectable trend or drift. It is commonly used as a test of stationarity (the alternative hypothesis). According to Wikipedia, the test typically involves three sub-tests covering the various combinations of drift and trend.
The test is independently implemented in two R packages: aTSA and tseries. However, for the dataset I'm dealing with, the two functions give very different values:
> aTSA::adf.test(my.data)
Augmented Dickey-Fuller Test
alternative: stationary
Type 1: no drift no trend
lag ADF p.value
[1,] 0 -1.36 0.19
[2,] 1 -2.93 0.01
[3,] 2 -3.12 0.01
[4,] 3 -3.21 0.01
Type 2: with drift no trend
lag ADF p.value
[1,] 0 -1.34 0.5735
[2,] 1 -2.90 0.0524
[3,] 2 -3.10 0.0347
[4,] 3 -3.17 0.0281
Type 3: with drift and trend
lag ADF p.value
[1,] 0 -1.60 0.7351
[2,] 1 -3.25 0.0870
[3,] 2 -3.56 0.0432
[4,] 3 -3.52 0.0468
----
Note: in fact, p.value = 0.01 means p.value <= 0.01
> tseries::adf.test(my.data)
Augmented Dickey-Fuller Test
data: my.data
Dickey-Fuller = -2.8353, Lag order = 4, p-value = 0.2357
alternative hypothesis: stationary
You'll note that the tseries result, -2.8353, doesn't appear anywhere in the aTSA result set, let alone at lag=4.
A simple test suggests that the tseries output corresponds to the type-3 test result, and usually matches perfectly well:
> x <- rnorm(100)
> lag <- 4
> aTSA::adf.test(x, output=FALSE)$type3[lag+1,"ADF"]
ADF
-5.74654
> tseries::adf.test(x)$statistic
Dickey-Fuller
-5.74654
So it looks like I've just hit on an interesting (as in "interesting times") dataset.
What statistical properties of the data could give rise to this kind of discrepancy? How can I reconcile the two ADF functions' results?
There's a related question here, but the accepted answer doesn't actually explain what could give rise to the difference, it just suggests that there shouldn't be a difference.