Description Usage Arguments Details Value Note Author(s) References See Also Examples

Performs the Augmented Dickey-Fuller test for the null hypothesis
of a unit root of a univarate time series `x`

(equivalently, `x`

is a
non-stationary time series).

1 |

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

`nlag` |
the lag order with default to calculate the test statistic. See details for the default. |

`output` |
a logical value indicating to print the test results in R console.
The default is |

The Augmented Dickey-Fuller test incorporates
three types of linear regression models. The first type (`type1`

) is a linear model
with no drift and linear trend with respect to time:

*dx[t] = ρ*x[t-1] + β[1]*dx[t-1] + ... + β[nlag - 1]*dx[t - nlag + 1]
+e[t],*

where *d* is an operator of first order difference, i.e.,
*dx[t] = x[t] - x[t-1]*, and *e[t]* is an error term.

The second type (`type2`

) is a linear model with drift but no linear trend:

*dx[t] = μ + ρ*x[t-1] + β[1]*dx[t-1] + ... +
β[nlag - 1]*dx[t - nlag + 1] +e[t].*

The third type (`type3`

) is a linear model with both drift and linear trend:

*dx[t] = μ + β*t + ρ*x[t-1] + β[1]*dx[t-1] + ... +
β[nlag - 1]*dx[t - nlag + 1] +e[t].*

We use the default `nlag = floor(4*(length(x)/100)^(2/9))`

to
calcuate the test statistic.
The Augmented Dickey-Fuller test statistic is defined as

*ADF = ρ.hat/S.E(ρ.hat),*

where *ρ.hat* is the coefficient estimation
and *S.E(ρ.hat)* is its corresponding estimation of standard error for each
type of linear model. The p.value is
calculated by interpolating the test statistics from the corresponding critical values
tables (see Table 10.A.2 in Fuller (1996)) for each type of linear models with given
sample size *n* = length(`x`

).
The Dickey-Fuller test is a special case of Augmented Dickey-Fuller test
when `nlag`

= 2.

A list containing the following components:

`type1` |
a matrix with three columns: |

`type2` |
same as above for the second type of linear model. |

`type3` |
same as above for the third type of linear model. |

Missing values are removed.

Debin Qiu

Fuller, W. A. (1996). Introduction to Statistical Time Series, second ed., New York: John Wiley and Sons.

`pp.test`

, `kpss.test`

, `stationary.test`

1 2 3 4 5 |

```
Attaching package: 'aTSA'
The following object is masked from 'package:graphics':
identify
Augmented Dickey-Fuller Test
alternative: stationary
Type 1: no drift no trend
lag ADF p.value
[1,] 0 -7.00 0.01
[2,] 1 -6.28 0.01
[3,] 2 -5.45 0.01
[4,] 3 -5.44 0.01
[5,] 4 -5.27 0.01
Type 2: with drift no trend
lag ADF p.value
[1,] 0 -6.97 0.01
[2,] 1 -6.25 0.01
[3,] 2 -5.43 0.01
[4,] 3 -5.43 0.01
[5,] 4 -5.24 0.01
Type 3: with drift and trend
lag ADF p.value
[1,] 0 -6.95 0.01
[2,] 1 -6.24 0.01
[3,] 2 -5.47 0.01
[4,] 3 -5.50 0.01
[5,] 4 -5.27 0.01
----
Note: in fact, p.value = 0.01 means p.value <= 0.01
Augmented Dickey-Fuller Test
alternative: stationary
Type 1: no drift no trend
lag ADF p.value
[1,] 0 1.852 0.984
[2,] 1 0.715 0.850
[3,] 2 1.310 0.952
[4,] 3 1.706 0.978
[5,] 4 1.846 0.984
[6,] 5 2.176 0.990
Type 2: with drift no trend
lag ADF p.value
[1,] 0 -0.515 0.872
[2,] 1 -1.780 0.416
[3,] 2 -0.929 0.726
[4,] 3 -0.453 0.894
[5,] 4 -0.372 0.909
[6,] 5 -0.222 0.929
Type 3: with drift and trend
lag ADF p.value
[1,] 0 -5.19 0.01
[2,] 1 -15.09 0.01
[3,] 2 -9.47 0.01
[4,] 3 -7.68 0.01
[5,] 4 -7.58 0.01
[6,] 5 -6.84 0.01
----
Note: in fact, p.value = 0.01 means p.value <= 0.01
```

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.