| Title: | Quantile Augmented Dickey-Fuller Unit Root Test |
|---|---|
| Description: | Implements the Quantile Augmented Dickey-Fuller (QADF) unit root test following Koenker and Xiao (2004) <doi:10.1198/016214504000000296>. The test extends the standard ADF test to different quantiles of the conditional distribution, allowing for unit root behavior that varies across the distribution. Includes the QKS (Quantile Kolmogorov-Smirnov) supremum test statistic for overall unit root inference, critical values from Hansen (1995), bootstrap p-values, half-life calculations, and visualization tools. Useful for testing purchasing power parity, asymmetric adjustment, and regime-dependent persistence. |
| Authors: | Muhammad Abdullah Alkhalaf [aut, cre] (ORCID: <https://orcid.org/0009-0002-2677-9246>), Merwan Roudane [ctb] (Original Stata implementation) |
| Maintainer: | Muhammad Abdullah Alkhalaf <[email protected]> |
| License: | GPL-3 + file LICENSE |
| Version: | 1.0.0 |
| Built: | 2026-05-28 07:23:09 UTC |
| Source: | https://github.com/muhammedalkhalaf/qadf |
Performs the Quantile ADF unit root test following Koenker & Xiao (2004). Tests for unit root across the conditional distribution using quantile regression.
qadf(y, model = c("c", "ct", "nc"), pmax = 4, ic = c("AIC", "BIC", "t-stat"), tau = seq(0.1, 0.9, 0.1)) ## S3 method for class 'qadf' print(x, ...) ## S3 method for class 'qadf' summary(object, ...) ## S3 method for class 'qadf' plot(x, ...)qadf(y, model = c("c", "ct", "nc"), pmax = 4, ic = c("AIC", "BIC", "t-stat"), tau = seq(0.1, 0.9, 0.1)) ## S3 method for class 'qadf' print(x, ...) ## S3 method for class 'qadf' summary(object, ...) ## S3 method for class 'qadf' plot(x, ...)
y |
A numeric vector or time series. |
model |
Character. Deterministic component: "c" for constant (default), "ct" for constant and trend, "nc" for no constant. |
pmax |
Integer. Maximum number of lags for augmentation. Default is 4. |
ic |
Character. Information criterion for lag selection: "AIC", "BIC", or "t-stat". |
tau |
Numeric vector. Quantiles to test. Default is seq(0.1, 0.9, 0.1). |
x, object
|
An object of class "qadf". |
... |
Additional arguments (currently ignored). |
The Quantile ADF test extends the standard ADF test to different quantiles of the conditional distribution. This allows testing for unit root behavior that may vary across the distribution (e.g., different persistence in expansions vs recessions).
The test statistic at quantile tau is:
Critical values are interpolated from Hansen (1995) response surfaces.
The QKS (Quantile Kolmogorov-Smirnov) statistic is:
An object of class "qadf" containing:
results |
Data frame with test results for each quantile |
qks |
QKS statistic (supremum of absolute t-statistics) |
qks_cv |
Critical values for QKS statistic |
model |
Model specification |
lags |
Selected lag order |
n |
Sample size |
y |
Original series |
Koenker, R., & Xiao, Z. (2004). Unit root quantile autoregression inference. Journal of the American Statistical Association, 99(467), 775-787. doi:10.1198/016214504000000296
Hansen, B. E. (1995). Rethinking the univariate approach to unit root testing. Econometric Theory, 11(5), 1148-1171.
# Generate a random walk set.seed(123) y <- cumsum(rnorm(200)) # Basic QADF test result <- qadf(y) print(result) # Test specific quantiles result <- qadf(y, tau = c(0.1, 0.5, 0.9)) # With trend result <- qadf(y, model = "ct") summary(result)# Generate a random walk set.seed(123) y <- cumsum(rnorm(200)) # Basic QADF test result <- qadf(y) print(result) # Test specific quantiles result <- qadf(y, tau = c(0.1, 0.5, 0.9)) # With trend result <- qadf(y, model = "ct") summary(result)
Computes bootstrap p-value for the QKS statistic from a QADF test.
qadf_bootstrap(object, nboot = 199, seed = NULL)qadf_bootstrap(object, nboot = 199, seed = NULL)
object |
A "qadf" object from |
nboot |
Number of bootstrap replications. Default 199. |
seed |
Random seed for reproducibility. |
The bootstrap procedure follows Koenker and Xiao (2004):
Fit AR(p) model to first differences
Resample centered residuals
Generate bootstrap series under unit root null
Calculate QKS statistic for each bootstrap sample
P-value is proportion of bootstrap QKS >= observed QKS
Updated "qadf" object with additional elements:
qks_pvalue |
Bootstrap p-value for the QKS statistic |
qks_boot |
Vector of bootstrap QKS statistics |
nboot |
Number of successful bootstrap replications |
Koenker, R., & Xiao, Z. (2004). Unit root quantile autoregression inference. Journal of the American Statistical Association, 99(467), 775-787.
set.seed(123) y <- cumsum(rnorm(200)) result <- qadf(y) result <- qadf_bootstrap(result, nboot = 99) print(result)set.seed(123) y <- cumsum(rnorm(200)) result <- qadf(y) result <- qadf_bootstrap(result, nboot = 99) print(result)