I played around with some unit root testing in R and I am not entirely sure what to make of the k lag parameter. I used the augmented Dickey Fuller test and the Philipps Perron test from the tseries package. Obviously the default $k$ parameter (for the adf.test) depends only on the length of the series. If I choose different $k$-values I get pretty different results wrt. rejecting the null:

Dickey-Fuller = -3.9828, Lag order = 4, p-value = 0.01272
alternative hypothesis: stationary 
# 103^(1/3)=k=4 

Dickey-Fuller = -2.7776, Lag order = 0, p-value = 0.2543
alternative hypothesis: stationary
# k=0

Dickey-Fuller = -2.5365, Lag order = 6, p-value = 0.3542
alternative hypothesis: stationary
# k=6

plus the PP test result:

Dickey-Fuller Z(alpha) = -18.1799, Truncation lag parameter = 4, p-value = 0.08954
alternative hypothesis: stationary 

Looking at the data, I would think the underlying data is non-stationary, but still I do not consider these results a strong backup, in particular since I do not understand the role of the $k$ parameter. If I look at decompose / stl I see that the trend has strong impact as opposed to only small contribution from remainder or seasonal variation. My series is of quarterly frequency.

Any hints?

  • 4
    $\begingroup$ this book should answer all your questions. $\endgroup$
    – mpiktas
    Mar 6, 2011 at 22:53
  • 1
    $\begingroup$ thanks! I love the Springer useR series, but I did not know this one... $\endgroup$
    – hans0l0
    Mar 6, 2011 at 23:03
  • $\begingroup$ hmm, iiuc these test only whether phi = 1, not if phi > 1. But still the R output says the alternative is: stationarity. So do they check phi > 1, too? Obviously that would be non-stationary as well. $\endgroup$
    – hans0l0
    Mar 7, 2011 at 9:25

2 Answers 2


It's been a while since I looked at ADF tests, however I do remember at least two versions of the adf test.



The fUnitRoots package has a function called adfTest(). I think the "trend" issue is handled differently in those packages.

Edit ------ From page 14 of the following link, there were 4 versions (uroot discontinued) of the adf test:


One more link. Read section 6.3 in the following link. It does a far btter job than I could do in explaining the lag term:


Also, I would be careful with any seasonal model. Unless you're sure there's some seasonality present, I would avoid using seasonal terms. Why? Anything can be broken down into seasonal terms, even if it's not. Here are two examples:

#First example: White noise
x <- rnorm(200)

#Use stl() to separate the trend and seasonal term
x.ts <- ts(x, freq=4) 
x.stl <- stl(x.ts, s.window = "periodic")

#Use decompose() to separate the trend and seasonal term
x.dec <- decompose(x.ts)


#Second example, MA process
x1 <- cumsum(x)

#Use stl() to separate the trend and seasonal term
x1.ts <- ts(x1, freq=4)
x1.stl <- stl(x1.ts, s.window = "periodic")

#Use decompose() to separate the trend and seasonal term
x1.dec <- decompose(x1.ts)

The graph below is from the above plot(x.stl) statement. stl() found a small seasonal term in white noise. You might say that term is so small that it's really not an issue. The problem is, in real data, you don't know if that term is a problem or not. In the example below, notice that the trend data series has segments where it looks like a filtered version of the raw data, and other segments where it might be considered significantly different than the raw data.

enter image description here


The k parameter is a set of lags added to address serial correlation. The A in ADF means that the test is augmented by the addition of lags. The selection of the number of lags in ADF can be done a variety of ways. A common way is to start with a large number of lags selected a priori and reduce the number of lags sequentially until the longest lag is statistically significant.

You could test for serial correlation in the residuals after applying the lags in ADF.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.