Skip to content

Dickey Fuller test of a time series (problem)

2 messages · Matthias Brink, Wolfgang Koller

#
The argument 'x' of adf.test should not only be a vector but also a 
numeric vector (see ?adf.test). Have a closer look at your data and 
how they are stored. What does  is.numeric(x)  give? I guess that 
originally your data are stored as a data frame. Converting a 
data.frame to a vector is not done properly by c(), as the following 
example shows:
z <- rnorm(289)
x <- data.frame(z)
adf.test(x,k=1)   # produces an error
y <- c(x)
is.numeric(y)     # FALSE
adf.test(y,k=1)   # produces an error
k <- 1
y <- x[,1]           #  or y <- x$z
adf.test(y,k=1)   # this works well
At 10:31 20.03.2009, you wrote: