Augmented Dickey-Fuller Test and Lag Length In R, using the package tseries, one uses the command adf.test for the Augmented Dickey-Fuller Test. However, this assumes a certain number of lags, unless specified.
I have a two-part question:


*

*How are the number of lags calculated? (Is this using the Akaike Information Criterion, for instance?)

*Is it ever possible for the (Augmented) Dickey-Fuller to support different hypotheses based on different lag lengths? e.g.: A time series modeled as an AR(1) may show up as non-stationary, but the same series modeled as an AR(12) is stationary.
 A: From ?adf.test, 
adf.test(x, alternative = c("stationary", "explosive"), k = trunc((length(x)-1)^(1/3)))

That is, a deterministic "rule-of-thumb" is the default for the lag length k. You could supply your own lag length based on the AIC, though, and that would be a valid idea (which is also implemented in other packages, I believe).
Question 2 can also be answered with a yes.
Try, e.g.,
library(tseries)
set.seed(7)
y <- diffinv(rnorm(1000))   # contains a unit-root
adf.test(y, k=12)
adf.test(y, k=1)

This leads to disagreement at the 10% level.
The underlying reason is, like in any other regression, that adding/removing regressors (lagged differences in this case) that are correlated with some regressor of interest (the lagged level in this case) changes the coefficients and standard errors for that regressor, and hence the t-statistic, p-value and thus, possibly, the test decision.
Many papers in the unit root literature (e.g., Chang and Park, Econometric Reviews 2002 therefore provide results as to how to pick the number of lags in the ADF test regression.
