I didn't try to replicate the problems with gretl but at least the R packages you mention seem to agree if both the deterministics (trend vs. constant aka drift vs. none) and the lags (fixed, information criteria, heuristics) are specified in the same way. There are differences in the way the p-values are computed but for the data x
you generated they are very similar.
I have written the overview below for my students and thought I could share it here if someone finds it useful. Personally, I mostly used tseries
and CADFtest
:
adf.test()
in tseries
.
Deterministics: Linear trend only.
Lags: Heuristic by default, but can be selected by the user.
P-value: From critical value table.
CADFtest()
in CADFtest
.
Deterministics: Trend by default, constant (aka drift) or none also supported.
Lags: Default is 1 but can be selected via information criteria or by the user.
P-value: Computation based on Costantini et al. (2007). See also Lupi (2009). Unit Root CADF Testing with R. Journal of
Statistical Software, 32 (2), 1-19. http://www.jstatsoft.org/v32/i02/.
Comments: Additional regressors (and their lags) can be added to auxiliary
regression.
ur.df()
in urca
.
Deterministics: None by default, constant and trend also supported.
Lags: Default is 1, but can be selected via information criteria or by the user.
P-value: None, but summary()
reports critical value table (1%, 5%, 10%).
adfTest()
in fUnitRoots
.
Deterministics: None by default, constant and trend also supported.
Lags: Default is 1, but can be selected by the user.
P-value: From critical value table.
Comments: Based on adf.test()
from tseries
but extended by
additional deterministics.
For the data you had generated:
set.seed(1)
x <- rnorm(50, 0, 3)
Let's look at the different results for the test with trend (because this is supported by all functions) and 10 lags (as suggested by your heuristic above). The test statistics is always exactly the same and the p-values are close.
tseries::adf.test(x, k = 10)
## Augmented Dickey-Fuller Test
##
## data: x
## Dickey-Fuller = -1.6757, Lag order = 10, p-value = 0.7044
## alternative hypothesis: stationary
library("CADFtest")
CADFtest(x, max.lag.y = 10, type = "trend")
## ADF test
##
## data: x
## ADF(10) = -1.6757, p-value = 0.743
## alternative hypothesis: true delta is less than 0
## sample estimates:
## delta
## -1.751283
urca::ur.df(x, lags = 10, type = "trend")
## ###############################################################
## # Augmented Dickey-Fuller Test Unit Root / Cointegration Test #
## ###############################################################
##
## The value of the test statistic is: -1.6757 1.3699 2.0189
fUnitRoots::adfTest(x, lags = 10, type = "ct")
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -1.6757
## P VALUE:
## 0.7044
##
## Description:
## Sat Aug 22 20:19:18 2015 by user: zeileis