Date: Fri, 3 May 2013 10:25:31 +0200
From: Matthieu Stigler<matthieu.stigler at gmail.com>
To: "Brian G. Peterson"<brian at braverock.com>,yitaoz at stanford.edu,
Kurt.Hornik at r-project.org
Cc:"r-sig-finance at r-project.org" <r-sig-finance at r-project.org>
Subject: Re: [R-SIG-Finance] Using adf.test to test time series
stationarity of stock price
Message-ID:
<CAEYvig+hrDqKGXaetr=H=vy1FYsXiuB60hSkZoDt6L3L31od8Q at mail.gmail.com>
Content-Type: text/plain
Hi
With our stated background in stats, we should have realised that the
result you obtain is indeed surprising, since your t-stat is large, but
positive! A positive t-stat implies actually that your rho is bigger than
1... So in this case, you will not reject the alternative of stationarity,
but that of explosivity, try:
adf.test(stock2[,1], alternative="explosive")
That said, we should have also realised that results in adf.test seem to be
incorrect, since they do not correspond to the ones in:
library(urca)
ur.df(stock2[,1], lags=12, type="trend")
# or the corresponding "ADF" regression from tsDyn:
library(tsDyn)
ar_ts <- linear(stock2[,1], m=12, include="both", type="ADF")
summary(ar_ts)$coef["phi.1",]
Both urca and tsDyn agree closely on the t-stat, at -2.4578550 for urca,
and -2.466884912 for tsDyn (differences come from the way of counting
degrees of freedom, urca discards the initial values, while tsDyn does not,
as in ar()). Looking closer at the code of adf.test(), it looks like the
regression is \Delta y_t = const + trend + y_t while I would have expected
a y_{t-1}. I guess code should be corrected as:
xt1 <- x[(k-1):(n-1)]
instead of
xt1 <- x[k:n]
once this done, adf.test does correspond to the others. And now Brian's
point that prices are usually non-stationary holds.
I am ccing the maintainer of tseries on this.
Best
Matthieu
2013/4/22 Brian G. Peterson<brian at braverock.com>
On 04/21/2013 06:28 PM, Yitao Zhang wrote:
Hey guys,
I'm trying to do a augmented Dickey-Fuller test to test the stationarity
of a stock price.
With your stated economics background, one would assume that you'd realize
that price is almost never stationary.
Perhaps try on returns?
--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock