I'm having a problem with the Dickey-Fuller p-values and test statistic for unit root test in R. I tried using functions:
urca::ur.df()
fUnitRoots::adfTest()
tseries::adf.test()
All of them showed different results for the same test settings (lag, type) compared to the gretl output.
For example:
set.seed(1)
x <- rnorm(50, 0, 3)
schwert.param <- trunc(12 * (length(na.omit(x)) / 100) ^ (1 / 4))
adfTest(x = na.omit(x), lags = schwert.param, type = "nc", title = NULL, description = NULL)
# Title:
# Augmented Dickey-Fuller Test
#
# Test Results:
# PARAMETER:
# Lag Order: 10
# STATISTIC:
# Dickey-Fuller: -2.4362
# P VALUE: 0.01749
And for the same vector x in gretl I got:
> Test statistic: tau_nc(1) = -4.03652
> Asymptotic p-value = 5.57e-005
Both test settings were without constant and trend, lags = 10. So, why I'm getting different result for the same data input. I know, Dickey-Fuller test is using Monte Carlo to obtain p-values for test statistic, but shuld they differ that much, or I'm doing sth wrong with that function in R?
@ChristophHanck @GraemeWalsh: Ok, probably I found what's going on here. First of all, I changed gretl language from polish to english, and I found there is an option checked by default in the ADF test window - "test down from maximum lag order" using Akaike information criterion. If I uncheck that option I'm going to get the same results as in R. Now I'd like to know how to use that option in R. Does anybody know how to do that?