# [R] Dickey Fuller test of a time series (problem)

Wolfgang Koller wolfgang.koller at wu-wien.ac.at
Fri Mar 20 15:51:09 CET 2009

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)
y <- c(x)
is.numeric(y)     # FALSE
k <- 1
y <- x[,1]           #  or y <- x\$z

At 10:31 20.03.2009, you wrote:
>Hi all,
>
>I tried to do a Dickey Fuller test with R using adf.test with a time
>series of german stock prices. I have 10 stocks from 1985 to 2009
>with monthly stock prices. So if you do the math I have 289 values
>for each stock.
>
>I tried to do the test for each stock alone and had the 289 values
>of my first stock listed in R.
>When I tried to do the test with command adf.test(x, k=1) the
>following warning displayed:
>
>Fehler in embed(y, k) : 'x' is not a vector or matrix   (Fehler means error)
>
>so I tried to write x as a vector with command: z<-c(x)
>
>I retried the test with adf.test(z, k=1) and the following error appeared:
>
>Fehler in embed(y, k) : wrong embedding dimension
>
>I tried quite a lot of other things but I cannot get why the test
>isn't working.
>
>test if the time series is stationary is crucial for my work.
>
>
>Thank you very much indeed
>
>Matthias
>         [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help