Learn R Programming

SignalY (version 1.1.1)

test_unit_root: Comprehensive Unit Root Test Suite

Description

Applies multiple unit root and stationarity tests to a time series, providing an integrated assessment of persistence properties. Implements Augmented Dickey-Fuller (ADF), Elliott-Rothenberg-Stock (ERS), Kwiatkowski-Phillips-Schmidt-Shin (KPSS), and Phillips-Perron tests.

Usage

test_unit_root(y, max_lags = NULL, significance_level = 0.05, verbose = FALSE)

Value

A list of class "signaly_unitroot" containing:

adf

Results from ADF tests (none, drift, trend specifications)

ers

Results from ERS tests (DF-GLS and P-test)

kpss

Results from KPSS tests (level and trend)

pp

Results from Phillips-Perron tests

summary

Data frame summarizing all test results

conclusion

Integrated conclusion about stationarity

persistence_type

Classification: stationary, trend-stationary, difference-stationary, or inconclusive

Arguments

y

Numeric vector of the time series to test.

max_lags

Maximum number of lags for ADF-type tests. If NULL, defaults to floor(12 * (length(y)/100)^0.25).

significance_level

Significance level for hypothesis testing. Default is 0.05.

verbose

Logical indicating whether to print detailed results.

Interpretation Strategy

The function synthesizes results using the following logic:

  1. If ADF/ERS reject unit root AND KPSS fails to reject stationarity: Series is likely stationary

  2. If ADF/ERS fail to reject AND KPSS rejects stationarity: Series likely has unit root (difference-stationary)

  3. If only trend-ADF rejects: Series is likely trend-stationary

  4. Conflicting results indicate inconclusive or structural breaks

Details

The battery of tests addresses different null hypotheses and specifications:

Augmented Dickey-Fuller (ADF) tests the null of a unit root against the alternative of stationarity. Three specifications are tested:

  • none: No constant, no trend (random walk)

  • drift: Constant included (random walk with drift)

  • trend: Constant and linear trend

Elliott-Rothenberg-Stock (ERS) tests provide more power than ADF by using GLS detrending. Two variants:

  • DF-GLS: GLS-detrended Dickey-Fuller test

  • P-test: Point-optimal test

KPSS reverses the hypotheses: null is stationarity, alternative is unit root. This allows testing the stationarity hypothesis directly.

Phillips-Perron uses non-parametric corrections for serial correlation, avoiding lag selection issues.

References

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(366), 427-431.

Elliott, G., Rothenberg, T. J., & Stock, J. H. (1996). Efficient Tests for an Autoregressive Unit Root. Econometrica, 64(4), 813-836.

Kwiatkowski, D., Phillips, P. C. B., Schmidt, P., & Shin, Y. (1992). Testing the null hypothesis of stationarity against the alternative of a unit root. Journal of Econometrics, 54(1-3), 159-178.

Phillips, P. C. B., & Perron, P. (1988). Testing for a unit root in time series regression. Biometrika, 75(2), 335-346.

See Also

ur.df, ur.ers, ur.kpss, ur.pp

Examples

Run this code
set.seed(123)
stationary <- arima.sim(list(ar = 0.5), n = 100)
result <- test_unit_root(stationary)
print(result$conclusion)

nonstationary <- cumsum(rnorm(100))
result2 <- test_unit_root(nonstationary)
print(result2$conclusion)

Run the code above in your browser using DataLab