[R] ADF

Achim Zeileis
Mon, 09 Sep 2013 16:16:17 -0000

On Mon, 9 Sep 2013, bgnumis wrote:

> Hi all,
>
> Imagine I hava e a simulated variable
> original<-matrix(rnorm(10000),100,100)
>
> If I install tseries and I run adf.test(original[,2],k=0)
>
> the result is:
>
> Augmented Dickey-Fuller Test
>
> data:  original[, 2]
> Dickey-Fuller = -11.5645, Lag order = 0, p-value = 0.01
> alternative hypothesis: stationary
>
> Mensajes de aviso perdidos
> In adf.test(original[, 2], k = 0) : p-value smaller than printed p-value
>
> I want to obtain de Dickey-Fuller -11.5645 but I cannot achive, I have
> tried all similar to that
>
> coef(summary(lm(originaldiff[[]~(1+originaltminus1)  ) ))[2,"t
value"]
>
> More or less to obtain the t value is this formala no?
>
> Has anyone prove me applying code that the ADF is similar like in a lm
> stimation?

## simulate white noise time series
set.seed(1)
x <- ts(rnorm(1000))

## conduct ADF test with only one lag
adf.test(x, k = 1)

## set up series differences and lags
d <- ts.intersect(dx = diff(x), x1 = lag(x, -1), dx1 = lag(diff(x), -1))

## auxiliary regression (lagged levels, lagged differences, time trend)
m <- lm(dx ~ x1 + dx1 + time(d), data = d)

## t statistic of lagged levels
summary(m)$coefficients[2,3]

Note that the default number of lags included in the auxiliary regression
is higher by default, see ?adf.test. There are also other implmentations
available in R that offer more/other options to ADF testing, e.g.,
"urca"
and "CADFtest" (see http://www.jstatsoft.org/v32/i02/).

> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>