[R] ADF test

Stefan Grosse singularitaet at gmx.net
Fri Jun 5 17:54:43 CEST 2009


koyel chakrabartti wrote:
> While doing the ADF test in R using the following command I am getting the
> error and the result..">
> x.ct=ur.df(rev$REVENUE,start=1,end=length(rev$REVENUE),frequency=1)
> Error in ur.df(rev$REVENUE, start = 1, end = length(rev$REVENUE), frequency
> = 1) :
>   unused argument(s) (start = 1, end = 4, frequency = 1)
>   

The error and code above does not fit to the code below. The arguments
start, end and frequency belong to the ts command which you probably
forgot in the code above.

Btw. it seems you have a time series of only 4 dates, so either there is
another mistake or you don't know what you do...


> t=1:length(x)
> plot(t,x)
> trend = lm(x~t)
> abline(lm(x~t))
> summary(trend)
> library(urca)
> x = ts(x, start=1, end = length(x), frequency=1)
> x.ct = ur.df(x,lags=0,type='trend')
> plot(x.ct)
> library(tseries)
> adf.test(x,alternative = "explosive" , k=0)
> summary(ur.df(x,lags=0,type='trend')
>




More information about the R-help mailing list