Unit root time series tests
UnitrootTests.RdCarry out augmented Dickey-Fuller tests for unit roots based on Banerjee's et al. tables and on J.G. McKinnons' numerical distribution functions.
Arguments
- x
a numeric vector or time series object.
- lags
the maximum number of lags used for error term correction.
- type
a character string describing the type of the unit root regression. Valid choices are
"nc"for a regression with no intercept (constant) nor time trend,"c"for a regression with an intercept (constant) but no time trend,"ct"for a regression with an intercept (constant) and a time trend. The default is"c".- title
a character string which allows for a project title.
- description
a character string which allows for a brief description.
Details
adfTest() computes test statistics and p-values along the
implementation from Trapletti's augmented Dickey-Fuller test for
unit roots. In contrast to Trapletti's function, three kind of test
types can be selected.
unitrootTest() computes test statistics and p-values using
McKinnon's response surface approach.
Value
an object from S4 class "fHTEST" with the following slots:
- @call
the function call.
- @data
a data frame with the input data.
- @data.name
a character string giving the name of the data frame.
- @test
a list object which holds the output of the underlying test function.
- @title
a character string with the name of the test.
- @description
a character string with a brief description of the test.
The entries of the @test slot include 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.
- $name
the name of the underlying function, which may be wrapped.
- $output
additional test results to be printed.
References
Banerjee A., Dolado J.J., Galbraith J.W., Hendry D.F. (1993); Cointegration, Error Correction, and the Econometric Analysis of Non-Stationary Data, Oxford University Press, Oxford.
Dickey, D.A., Fuller, W.A. (1979); Distribution of the estimators for autoregressive time series with a unit root, Journal of the American Statistical Association 74, 427–431.
MacKinnon, J.G. (1996); Numerical distribution functions for unit root and cointegration tests, Journal of Applied Econometrics 11, 601–618.
Said S.E., Dickey D.A. (1984); Testing for Unit Roots in Autoregressive-Moving Average Models of Unknown Order, Biometrika 71, 599–607.
Author
Adrian Trapletti for the tests adapted from R's "tseries" package,
Diethelm Wuertz for the Rmetrics R-port.
Examples
## a time series which contains no unit-root:
x <- rnorm(1000)
## a time series which contains a unit-root:
y <- cumsum(c(0, x))
adfTest(x)
#> Warning: p-value smaller than printed p-value
#>
#> Title:
#> Augmented Dickey-Fuller Test
#>
#> Test Results:
#> PARAMETER:
#> Lag Order: 1
#> STATISTIC:
#> Dickey-Fuller: -21.6501
#> P VALUE:
#> 0.01
#>
#> Description:
#> Fri Dec 19 11:12:20 2025 by user: georgi
adfTest(y)
#>
#> Title:
#> Augmented Dickey-Fuller Test
#>
#> Test Results:
#> PARAMETER:
#> Lag Order: 1
#> STATISTIC:
#> Dickey-Fuller: -0.9257
#> P VALUE:
#> 0.3213
#>
#> Description:
#> Fri Dec 19 11:12:20 2025 by user: georgi
unitrootTest(x)
#>
#> Title:
#> Augmented Dickey-Fuller Test
#>
#> Test Results:
#> PARAMETER:
#> Lag Order: 1
#> STATISTIC:
#> DF: -21.6501
#> P VALUE:
#> t: < 2.2e-16
#> n: 0.001088
#>
#> Description:
#> Fri Dec 19 11:12:20 2025 by user: georgi
unitrootTest(y)
#>
#> Title:
#> Augmented Dickey-Fuller Test
#>
#> Test Results:
#> PARAMETER:
#> Lag Order: 1
#> STATISTIC:
#> DF: -0.9257
#> P VALUE:
#> t: 0.3154
#> n: 0.4863
#>
#> Description:
#> Fri Dec 19 11:12:20 2025 by user: georgi