| Type: | Package |
| Title: | Comprehensive Unit Root and Stationarity Tests |
| Version: | 1.0.0 |
| Description: | A unified framework for unit root and stationarity testing including quantile ADF tests (Koenker and Xiao, 2004) <doi:10.1198/016214504000001114>, GARCH-based unit root tests with endogenous structural breaks (Narayan and Liu, 2015) <doi:10.1016/j.eneco.2014.11.021>, and comprehensive Dickey-Fuller, Phillips-Perron, KPSS, ERS/DF-GLS, Zivot-Andrews, and Kobayashi-McAleer tests with an Elder-Kennedy decision strategy (Elder and Kennedy, 2001) <doi:10.1080/00220480109595179>. |
| License: | GPL-3 |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| Depends: | R (≥ 3.5.0) |
| Imports: | stats, quantreg, tseries, urca, strucchange |
| Suggests: | testthat (≥ 3.0.0), zoo |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2026-03-24 11:13:25 UTC; acad_ |
| Author: | Muhammad Abdullah Alkhalaf
|
| Maintainer: | Muhammad Abdullah Alkhalaf <muhammedalkhalaf@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-03-27 11:10:03 UTC |
GARCH Unit Root Test with Endogenous Structural Breaks
Description
Implements the trend-GARCH(1,1) unit root test with up to three endogenous structural breaks proposed by Narayan and Liu (2015).
Usage
garchur(y, breaks = 2L, model = c("ct", "c"), trim = 0.15)
Arguments
y |
Numeric vector. The time-series variable to be tested. |
breaks |
Integer. Number of structural breaks (1, 2, or 3).
Default is |
model |
Character. Deterministic specification: |
trim |
Numeric. Trimming proportion for the break-date grid search,
between 0.05 and 0.30. Default is |
Details
The mean equation is:
y_t = a_0 + a_1 t + \rho y_{t-1} + \sum_j \gamma_j DU_{jt} + \varepsilon_t
The null hypothesis is H_0: \rho = 1 (unit root). Break dates are
selected by sequential maximum |t| search. GARCH parameters are
estimated by approximate maximum likelihood via Nelder-Mead optimisation.
Critical values are interpolated from Table III of Narayan and Liu (2015).
Value
A list of class "garchur" containing: stat (t-statistic),
rho, kappa, alpha, beta, ab,
halflife, loglik, break_dates, nobs,
cv1, cv5, cv10, model, breaks,
and decision.
References
Narayan, P. K., & Liu, R. (2015). A unit root model for trending time-series energy variables. Energy Economics, 46, 1–9. doi:10.1016/j.eneco.2014.11.021
Examples
set.seed(42)
y <- cumsum(rnorm(80))
res <- garchur(y, breaks = 2, model = "ct")
print(res)
Print Method for garchur Objects
Description
Prints a formatted summary of GARCH unit root test results.
Usage
## S3 method for class 'garchur'
print(x, ...)
Arguments
x |
An object of class |
... |
Further arguments passed to or from other methods (unused). |
Value
Invisibly returns x.
Examples
set.seed(1)
y <- cumsum(rnorm(60))
res <- garchur(y, breaks = 2)
print(res)
Print and Summary Methods for qadf Objects
Description
Print and summary methods for objects of class "qadf" returned
by qadf.
Usage
## S3 method for class 'qadf'
print(x, digits = 4L, ...)
## S3 method for class 'qadf'
summary(object, ...)
Arguments
x |
An object of class |
digits |
Integer. Number of significant digits for display. |
... |
Further arguments (ignored). |
object |
An object of class |
Value
Invisibly returns the input object.
Examples
set.seed(1)
y <- cumsum(rnorm(80))
res <- qadf(y, tau = 0.5)
print(res)
summary(res)
Quantile ADF Unit Root Test
Description
Implements the Quantile Autoregressive Distributed Lag (QADF) unit root test of Koenker and Xiao (2004). The test examines unit root behaviour across quantiles of the conditional distribution of a time series using quantile regression.
Usage
qadf(x, tau = 0.5, model = "c", max_lags = 8, ic = "aic")
Arguments
x |
A numeric vector or univariate time series object. |
tau |
A numeric scalar specifying the quantile at which to estimate
the model. Must satisfy |
model |
A character string specifying the deterministic component.
|
max_lags |
A non-negative integer specifying the maximum number of
augmentation lags to consider. Default is |
ic |
A character string for the information criterion used to select
the optimal lag length. One of |
Details
The QADF test estimates the autoregressive parameter \hat\rho(\tau)
at quantile \tau via quantile regression on the ADF regression
equation. The t-statistic t_n(\tau) = (\hat\rho(\tau) - 1) / se
tests H_0: \rho(\tau) = 1 (unit root) against
H_1: \rho(\tau) < 1 (stationarity).
Critical values are from Table 1 of Hansen (1995), interpolated
linearly for quantiles between tabulated values. The model
"c" corresponds to a demeaned ADF regression; "ct"
adds a linear time trend.
Value
An object of class "qadf" with components:
- statistic
The QADF t-statistic
t_n(\tau).- coef_stat
The
U_n(\tau) = n(\hat\rho(\tau) - 1)statistic.- rho_tau
Quantile autoregressive coefficient
\hat\rho(\tau).- rho_ols
OLS autoregressive coefficient.
- alpha_tau
Quantile intercept
\hat\alpha_0(\tau).- delta2
Nuisance parameter
\hat\delta^2.- half_life
Half-life implied by
\hat\rho(\tau), in periods.- opt_lags
Selected lag order.
- nobs
Number of observations used.
- critical_values
Named numeric vector of critical values at 1%, 5%, and 10% from Hansen (1995).
- tau
The quantile used.
- model
The deterministic model used.
- ic
The information criterion used.
- varname
The name of the input series.
References
Koenker, R. and Xiao, Z. (2004). Unit Root Quantile Autoregression Inference. Journal of the American Statistical Association, 99(465), 775–787. doi:10.1198/016214504000001114
Hansen, B. E. (1995). Rethinking the Univariate Approach to Unit Root Tests: How to Use Covariates to Increase Power. Econometric Theory, 11(5), 1148–1171. doi:10.1017/S0266466600009713
Examples
set.seed(42)
y <- cumsum(rnorm(100))
result <- qadf(y, tau = 0.5, model = "c", max_lags = 4)
print(result)
Comprehensive Unified Unit Root and Stationarity Testing
Description
Runs a comprehensive battery of unit root and stationarity tests on one or more time series, producing formatted summary tables and an integration-order decision following the Elder and Kennedy (2001) strategy.
Usage
urstat(
x,
tests = "ALL",
max_lag = 12L,
crit = "BIC",
pp_lag = 4L,
kpss_lags = 8L,
za_trim = 0.15,
level = 0.05,
stars = TRUE,
strategy = TRUE
)
Arguments
x |
A numeric vector, |
tests |
Character vector of tests to run. Possible values:
|
max_lag |
Integer. Maximum lag order for ADF lag selection (default 12). |
crit |
Character. Information criterion for ADF lag selection:
|
pp_lag |
Integer. Bandwidth (Newey-West lags) for PP test (default 4). |
kpss_lags |
Integer. Lag truncation for KPSS (default 8). |
za_trim |
Numeric. Trimming proportion for Zivot-Andrews test (default 0.15). |
level |
Numeric. Significance level used for decisions (default 0.05). |
stars |
Logical. Print significance stars (default |
strategy |
Logical. Print Elder-Kennedy decision table
(default |
Value
A list (invisibly) containing one element per series. Each element is itself a named list with components:
adfResults from ADF tests (list).
ppResults from PP tests (list).
kpssResults from KPSS tests (list).
ersResults from ERS/DF-GLS tests (list).
zaResults from Zivot-Andrews test (list).
decisionCharacter. Inferred integration order.
processCharacter. Suggested data transformation.
References
Elder, J. and Kennedy, P. E. (2001). Testing for unit roots: What should students be taught? Journal of Economic Education, 32(2), 137-146. doi:10.1080/00220480109595179
Dickey, D. A. and 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. doi:10.2307/2286348
Phillips, P. C. B. and Perron, P. (1988). Testing for a unit root in time series regression. Biometrika, 75(2), 335-346. doi:10.1093/biomet/75.2.335
Kwiatkowski, D., Phillips, P. C. B., Schmidt, P., and Shin, Y. (1992). Testing the null hypothesis of stationarity against the alternative of a unit root. Journal of Econometrics, 54(1-3), 159-178. doi:10.1016/0304-4076(92)90104-Y
Elliott, G., Rothenberg, T. J., and Stock, J. H. (1996). Efficient tests for an autoregressive unit root. Econometrica, 64(4), 813-836. doi:10.2307/2171846
Zivot, E. and Andrews, D. W. K. (1992). Further evidence on the great crash, the oil-price shock, and the unit-root hypothesis. Journal of Business & Economic Statistics, 10(3), 251-270. doi:10.1080/07350015.1992.10509904
Examples
set.seed(42)
x <- cumsum(rnorm(60))
res <- urstat(x, tests = c("ADF", "PP", "KPSS"), strategy = FALSE)