13
$\begingroup$

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?

$\endgroup$
  • 3
    $\begingroup$ this book should answer all your questions. $\endgroup$ – mpiktas Mar 6 '11 at 22:53
  • 1
    $\begingroup$ thanks! I love the Springer useR series, but I did not know this one... $\endgroup$ – hans0l0 Mar 6 '11 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 '11 at 9:25
4
$\begingroup$

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

http://www.stat.ucl.ac.be/ISdidactique/Rhelp/library/tseries/html/adf.test.html

http://cran.r-project.org/web/packages/fUnitRoots/

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:

http://math.uncc.edu/~zcai/FinTS.pdf

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:

http://www.yats.com/doc/cointegration-en.html

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")
plot(x.stl)

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

#===========================================

#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")
plot(x1.stl)

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

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

$\endgroup$
1
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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