# R Unit Root Tests

From adf.test help

package: tseries

`x <- rnorm(1000) `

**# no unit-root**

adf.test(x)

Augmented Dickey-Fuller Test

data: x

Dickey-Fuller = -10.0235, Lag order = 9, p-value = **0.01** <- Safe to **reject null hypothesis that x has a unit root**

alternative hypothesis: stationary

Warning message:

In adf.test(x) : p-value smaller than printed p-value

PP.test(x)

Phillips-Perron Unit Root Test

data: x

Dickey-Fuller = -33.4783, Truncation lag parameter = 7, p-value = **0.01**<- Safe to **reject null hypothesis that x has a unit root**

`y <- diffinv(x) `

**# contains a unit-root**

adf.test(y)

Augmented Dickey-Fuller Test

data: y

Dickey-Fuller = -1.7578, Lag order = 9, p-value = **0.6808** <- Fail to reject null hypothesis that** x has a unit root**

alternative hypothesis: stationary

PP.test(y)

Phillips-Perron Unit Root Test

data: y

Dickey-Fuller = -1.9082, Truncation lag parameter = 7, p-value = **0.6172 **<- Failto reject null hypothesis that **x has a unit root**