adf.test | R Documentation |

Computes the Augmented Dickey-Fuller test for the null that `x`

has
a unit root.

```
adf.test(x, alternative = c("stationary", "explosive"),
k = trunc((length(x)-1)^(1/3)))
```

`x` |
a numeric vector or time series. |

`alternative` |
indicates the alternative hypothesis and must be
one of |

`k` |
the lag order to calculate the test statistic. |

The general regression equation which incorporates a constant and a
linear trend is used and the t-statistic for a first order
autoregressive coefficient equals one is computed. The number of lags
used in the regression is `k`

. The default value of
`trunc((length(x)-1)^(1/3))`

corresponds to the suggested upper
bound on the rate at which the number of lags, `k`

, should be
made to grow with the sample size for the general `ARMA(p,q)`

setup. Note that for `k`

equals zero the standard Dickey-Fuller
test is computed. The p-values are interpolated from Table 4.2, p. 103
of Banerjee et al. (1993). If the computed statistic is outside the
table of critical values, then a warning message is generated.

Missing values are not allowed.

A list with class `"htest"`

containing the following components:

`statistic` |
the value of the test statistic. |

`parameter` |
the lag order. |

`p.value` |
the p-value of the test. |

`method` |
a character string indicating what type of test was performed. |

`data.name` |
a character string giving the name of the data. |

`alternative` |
a character string describing the alternative hypothesis. |

A. Trapletti

A. Banerjee, J. J. Dolado, J. W. Galbraith, and D. F. Hendry (1993):
*Cointegration, Error Correction, and the Econometric Analysis of
Non-Stationary Data*,
Oxford University Press, Oxford.

S. E. Said and D. A. Dickey (1984):
Testing for Unit Roots in Autoregressive-Moving Average Models of
Unknown Order.
*Biometrika* **71**, 599–607.

`pp.test`

```
x <- rnorm(1000) # no unit-root
adf.test(x)
y <- diffinv(x) # contains a unit-root
adf.test(y)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.