| Title: | Quantile Autoregressive Distributed Lag Model |
|---|---|
| Description: | Implements the Quantile Autoregressive Distributed Lag (QARDL) model of Cho, Kim and Shin (2015) <doi:10.1016/j.jeconom.2015.01.003>. Estimates quantile-specific long-run (beta), short-run autoregressive (phi), and impact (gamma) parameters. Features include BIC-based automatic lag selection, Error Correction Model (ECM) parameterization, Wald tests for parameter constancy across quantiles, rolling/recursive QARDL estimation, Monte Carlo simulation, and publication-ready output tables. |
| Authors: | Muhammad Alkhalaf [aut, cre, cph] (ORCID: <https://orcid.org/0009-0002-2677-9246>), Jin Seo Cho [ctb] (Original methodology), Tae-Hwan Kim [ctb] (Original methodology), Yongcheol Shin [ctb] (Original methodology) |
| Maintainer: | Muhammad Alkhalaf <[email protected]> |
| License: | GPL-3 |
| Version: | 1.0.1 |
| Built: | 2026-05-28 07:28:55 UTC |
| Source: | https://github.com/muhammedalkhalaf/qardlr |
Extract coefficients from a QARDL model.
## S3 method for class 'qardl' coef(object, type = c("all", "beta", "phi", "gamma"), ...)## S3 method for class 'qardl' coef(object, type = c("all", "beta", "phi", "gamma"), ...)
object |
An object of class |
type |
Character. Which coefficients to extract: |
... |
Additional arguments (unused). |
Matrix or list of coefficient matrices.
Creates time series plots of rolling QARDL parameter estimates.
## S3 method for class 'qardl_rolling' plot(x, which = c("beta", "phi", "gamma", "rho"), var = 1, tau_idx = NULL, ...)## S3 method for class 'qardl_rolling' plot(x, which = c("beta", "phi", "gamma", "rho"), var = 1, tau_idx = NULL, ...)
x |
Object of class |
which |
Character. Which parameter to plot: |
var |
Integer or character. Which variable to plot (for beta/gamma). Default is 1. |
tau_idx |
Integer. Which quantile index to plot. Default is all. |
... |
Additional arguments passed to |
Invisible NULL.
Generate predictions from a fitted QARDL model.
## S3 method for class 'qardl' predict(object, newdata = NULL, tau = NULL, ...)## S3 method for class 'qardl' predict(object, newdata = NULL, tau = NULL, ...)
object |
An object of class |
newdata |
Optional data frame for prediction. If |
tau |
Quantile(s) for prediction. Default uses all fitted quantiles. |
... |
Additional arguments (unused). |
Matrix of predicted quantiles.
Prints a formatted BIC grid for lag selection.
print_bic_grid(bic_result, digits = 3)print_bic_grid(bic_result, digits = 3)
bic_result |
Result from |
digits |
Number of decimal places. Default is 3. |
Invisible NULL. Called for side effect of printing.
data(qardl_sim) y <- qardl_sim$y X <- as.matrix(qardl_sim[, c("x1", "x2")]) bic_result <- qardl_bic_select(y, X, pmax = 4, qmax = 4) print_bic_grid(bic_result)data(qardl_sim) y <- qardl_sim$y X <- as.matrix(qardl_sim[, c("x1", "x2")]) bic_result <- qardl_bic_select(y, X, pmax = 4, qmax = 4) print_bic_grid(bic_result)
Print method for QARDL estimation results.
## S3 method for class 'qardl' print(x, digits = 4, ...)## S3 method for class 'qardl' print(x, digits = 4, ...)
x |
An object of class |
digits |
Number of decimal places. Default is 4. |
... |
Additional arguments (unused). |
Invisible x.
Print Monte Carlo Results
## S3 method for class 'qardl_mc' print(x, digits = 4, ...)## S3 method for class 'qardl_mc' print(x, digits = 4, ...)
x |
Object of class |
digits |
Number of decimal places. Default is 4. |
... |
Additional arguments (unused). |
Invisible x.
Print Rolling QARDL Results
## S3 method for class 'qardl_rolling' print(x, ...)## S3 method for class 'qardl_rolling' print(x, ...)
x |
Object of class |
... |
Additional arguments (unused). |
Invisible x.
Print QARDL Wald Test Results
## S3 method for class 'qardl_wald' print(x, digits = 4, ...)## S3 method for class 'qardl_wald' print(x, digits = 4, ...)
x |
Object of class |
digits |
Number of decimal places. Default is 4. |
... |
Additional arguments (unused). |
Invisible x.
Estimates the Quantile ARDL (QARDL) model of Cho, Kim & Shin (2015). The model estimates quantile-specific long-run equilibrium relationships and short-run dynamics between a dependent variable and covariates.
qardl( formula, data, tau = c(0.25, 0.5, 0.75), p = 0L, q = 0L, pmax = 7L, qmax = 7L, ecm = FALSE, constant = TRUE )qardl( formula, data, tau = c(0.25, 0.5, 0.75), p = 0L, q = 0L, pmax = 7L, qmax = 7L, ecm = FALSE, constant = TRUE )
formula |
A formula of the form |
data |
A data frame containing the variables in the formula. |
tau |
Numeric vector of quantiles to estimate. Must be in (0, 1).
Default is |
p |
Integer. AR lag order for the dependent variable. If 0, automatically selected via BIC. Default is 0. |
q |
Integer. Distributed lag order for covariates. If 0, automatically selected via BIC. Default is 0. |
pmax |
Integer. Maximum AR lag order for BIC selection. Default is 7. |
qmax |
Integer. Maximum DL lag order for BIC selection. Default is 7. |
ecm |
Logical. If |
constant |
Logical. If |
The QARDL(p,q) model is specified as:
Long-run parameters are computed as:
The speed of adjustment (ECM coefficient) is:
Negative indicates convergence to long-run equilibrium.
An object of class "qardl" containing:
Long-run parameters matrix (k x ntau)
Standard errors for beta
Short-run AR parameters matrix (p x ntau)
Standard errors for phi
Short-run impact parameters matrix (k x ntau)
Standard errors for gamma
Speed of adjustment parameters (ECM coefficient)
Vector of estimated quantiles
AR lag order used
Distributed lag order used
Number of observations
Number of covariates
The matched call
The model formula
The data used
List of quantreg fit objects
BIC grid if lag selection was performed
Whether ECM parameterization was used
Cho, J.S., Kim, T.-H., & Shin, Y. (2015). Quantile cointegration in the autoregressive distributed-lag modeling framework. Journal of Econometrics, 188(1), 281-300. doi:10.1016/j.jeconom.2015.01.003
qardl_rolling, qardl_simulate,
qardl_wald, summary.qardl
# Load example data data(qardl_sim) # Basic QARDL estimation with automatic lag selection fit <- qardl(y ~ x1 + x2, data = qardl_sim, tau = c(0.25, 0.50, 0.75)) summary(fit) # QARDL with specified lags fit2 <- qardl(y ~ x1 + x2, data = qardl_sim, tau = c(0.1, 0.5, 0.9), p = 2, q = 2) print(fit2) # QARDL-ECM parameterization fit_ecm <- qardl(y ~ x1 + x2, data = qardl_sim, tau = c(0.25, 0.50, 0.75), ecm = TRUE) summary(fit_ecm)# Load example data data(qardl_sim) # Basic QARDL estimation with automatic lag selection fit <- qardl(y ~ x1 + x2, data = qardl_sim, tau = c(0.25, 0.50, 0.75)) summary(fit) # QARDL with specified lags fit2 <- qardl(y ~ x1 + x2, data = qardl_sim, tau = c(0.1, 0.5, 0.9), p = 2, q = 2) print(fit2) # QARDL-ECM parameterization fit_ecm <- qardl(y ~ x1 + x2, data = qardl_sim, tau = c(0.25, 0.50, 0.75), ecm = TRUE) summary(fit_ecm)
Automatically selects optimal lag orders (p, q) for the QARDL model using the Bayesian Information Criterion (BIC) evaluated at the median quantile (tau = 0.5).
qardl_bic_select(y, X, pmax = 7L, qmax = 7L, constant = TRUE)qardl_bic_select(y, X, pmax = 7L, qmax = 7L, constant = TRUE)
y |
Numeric vector of dependent variable. |
X |
Matrix of covariates. |
pmax |
Integer. Maximum AR lag order to consider. Default is 7. |
qmax |
Integer. Maximum distributed lag order to consider. Default is 7. |
constant |
Logical. Include intercept. Default is |
The BIC is computed using the Schwarz criterion at the median quantile:
where is the number of parameters (p AR terms + q*k impact terms
+ constant) and is the estimated residual variance.
A list containing:
Optimal AR lag order
Optimal distributed lag order
Matrix of BIC values (pmax x qmax)
Minimum BIC value
Cho, J.S., Kim, T.-H., & Shin, Y. (2015). Quantile cointegration in the autoregressive distributed-lag modeling framework. Journal of Econometrics, 188(1), 281-300. doi:10.1016/j.jeconom.2015.01.003
data(qardl_sim) y <- qardl_sim$y X <- as.matrix(qardl_sim[, c("x1", "x2")]) bic_result <- qardl_bic_select(y, X, pmax = 5, qmax = 5) print(bic_result$bic_grid)data(qardl_sim) y <- qardl_sim$y X <- as.matrix(qardl_sim[, c("x1", "x2")]) bic_result <- qardl_bic_select(y, X, pmax = 5, qmax = 5) print(bic_result$bic_grid)
Performs rolling or recursive window QARDL estimation to assess parameter stability over time.
qardl_rolling( formula, data, tau = c(0.25, 0.5, 0.75), p = 1L, q = 1L, window = 0L, method = c("rolling", "recursive"), constant = TRUE )qardl_rolling( formula, data, tau = c(0.25, 0.5, 0.75), p = 1L, q = 1L, window = 0L, method = c("rolling", "recursive"), constant = TRUE )
formula |
A formula of the form |
data |
A data frame containing the variables. |
tau |
Numeric vector of quantiles. Default is |
p |
Integer. AR lag order. Default is 1. |
q |
Integer. Distributed lag order. Default is 1. |
window |
Integer. Rolling window size. If 0, uses 10% of sample size. |
method |
Character. Either |
constant |
Logical. Include intercept. Default is |
Rolling window estimation helps detect structural breaks and assess parameter stability. The function estimates QARDL models on successive windows of data and tracks how parameters evolve over time.
For method = "rolling", a fixed window of size window is used.
For method = "recursive", the window expands from window
to the full sample.
An object of class "qardl_rolling" containing:
3D array of long-run parameters (k x ntau x nwindows)
3D array of AR parameters (p x ntau x nwindows)
3D array of impact parameters (k x ntau x nwindows)
Matrix of ECM coefficients (nwindows x ntau)
Matrix of beta constancy Wald statistics
Matrix of phi constancy Wald statistics
Matrix of gamma constancy Wald statistics
Vector of end dates for each window
Window size used
Method used ("rolling" or "recursive")
Vector of quantiles
Cho, J.S., Kim, T.-H., & Shin, Y. (2015). Quantile cointegration in the autoregressive distributed-lag modeling framework. Journal of Econometrics, 188(1), 281-300. doi:10.1016/j.jeconom.2015.01.003
data(qardl_sim) # Rolling estimation with 50-observation window roll <- qardl_rolling(y ~ x1 + x2, data = qardl_sim, tau = c(0.25, 0.50, 0.75), p = 2, q = 2, window = 50) print(roll) # Recursive estimation recur <- qardl_rolling(y ~ x1 + x2, data = qardl_sim, tau = c(0.50), p = 2, q = 2, window = 50, method = "recursive") print(recur)data(qardl_sim) # Rolling estimation with 50-observation window roll <- qardl_rolling(y ~ x1 + x2, data = qardl_sim, tau = c(0.25, 0.50, 0.75), p = 2, q = 2, window = 50) print(roll) # Recursive estimation recur <- qardl_rolling(y ~ x1 + x2, data = qardl_sim, tau = c(0.50), p = 2, q = 2, window = 50, method = "recursive") print(recur)
A simulated dataset for demonstrating QARDL estimation. The data is generated from a QARDL(2,2) process with two covariates.
qardl_simqardl_sim
A data frame with 200 observations and 3 variables:
Dependent variable generated from QARDL process
First covariate (I(1) random walk)
Second covariate (I(1) random walk)
The data generating process follows:
where and are independent random walks.
True parameters:
,
,
,
Cho, J.S., Kim, T.-H., & Shin, Y. (2015). Quantile cointegration in the autoregressive distributed-lag modeling framework. Journal of Econometrics, 188(1), 281-300. doi:10.1016/j.jeconom.2015.01.003
data(qardl_sim) head(qardl_sim) summary(qardl_sim) # Estimate QARDL model fit <- qardl(y ~ x1 + x2, data = qardl_sim, tau = c(0.25, 0.50, 0.75), p = 2, q = 2) summary(fit)data(qardl_sim) head(qardl_sim) summary(qardl_sim) # Estimate QARDL model fit <- qardl(y ~ x1 + x2, data = qardl_sim, tau = c(0.25, 0.50, 0.75), p = 2, q = 2) summary(fit)
Performs Monte Carlo simulation to assess the finite-sample properties of QARDL estimators under specified data generating processes.
qardl_simulate( nobs = 200L, reps = 1000L, tau = c(0.25, 0.5, 0.75), p = 1L, q = 1L, k = 1L, beta_true = NULL, phi_true = NULL, gamma_true = NULL, sigma_u = 1, sigma_x = 1, seed = NULL, parallel = FALSE, ncores = NULL )qardl_simulate( nobs = 200L, reps = 1000L, tau = c(0.25, 0.5, 0.75), p = 1L, q = 1L, k = 1L, beta_true = NULL, phi_true = NULL, gamma_true = NULL, sigma_u = 1, sigma_x = 1, seed = NULL, parallel = FALSE, ncores = NULL )
nobs |
Integer. Sample size for each simulation. Default is 200. |
reps |
Integer. Number of Monte Carlo replications. Default is 1000. |
tau |
Numeric vector of quantiles. Default is |
p |
Integer. AR lag order. Default is 1. |
q |
Integer. Distributed lag order. Default is 1. |
k |
Integer. Number of covariates. Default is 1. |
beta_true |
Numeric vector. True long-run parameters (length k).
Default is |
phi_true |
Numeric vector. True AR parameters (length p).
Default is |
gamma_true |
Numeric vector. True impact parameters (length k).
Default is |
sigma_u |
Numeric. Standard deviation of the error term. Default is 1. |
sigma_x |
Numeric. Standard deviation of covariate innovations. Default is 1. |
seed |
Integer. Random seed for reproducibility. Default is |
parallel |
Logical. Use parallel processing. Default is |
ncores |
Integer. Number of cores for parallel processing.
Default is |
The data generating process is:
where and follows a random walk
with innovations .
An object of class "qardl_mc" containing:
Array of simulated beta estimates (k x ntau x reps)
Array of simulated phi estimates (p x ntau x reps)
Array of simulated gamma estimates (k x ntau x reps)
True beta values
True phi values
True gamma values
Bias in beta estimates
RMSE of beta estimates
Empirical coverage of 95% CI for beta
Number of replications
Sample size
Vector of quantiles
Cho, J.S., Kim, T.-H., & Shin, Y. (2015). Quantile cointegration in the autoregressive distributed-lag modeling framework. Journal of Econometrics, 188(1), 281-300. doi:10.1016/j.jeconom.2015.01.003
# Small simulation for illustration mc <- qardl_simulate(nobs = 100, reps = 50, tau = c(0.25, 0.50, 0.75), p = 1, q = 1, k = 1, seed = 123) print(mc)# Small simulation for illustration mc <- qardl_simulate(nobs = 100, reps = 50, tau = c(0.25, 0.50, 0.75), p = 1, q = 1, k = 1, seed = 123) print(mc)
Creates formatted tables suitable for academic publications from QARDL estimation results.
qardl_table( x, type = c("text", "latex", "html"), include = c("beta", "gamma"), stars = TRUE, digits = 3, caption = NULL, label = NULL )qardl_table( x, type = c("text", "latex", "html"), include = c("beta", "gamma"), stars = TRUE, digits = 3, caption = NULL, label = NULL )
x |
An object of class |
type |
Character. Type of table: |
include |
Character vector. Which parameters to include:
|
stars |
Logical. Include significance stars. Default is |
digits |
Integer. Number of decimal places. Default is 3. |
caption |
Character. Table caption. Default is |
label |
Character. LaTeX label. Default is |
Character string containing the formatted table.
data(qardl_sim) fit <- qardl(y ~ x1 + x2, data = qardl_sim, tau = c(0.25, 0.50, 0.75), p = 2, q = 2) cat(qardl_table(fit, type = "text"))data(qardl_sim) fit <- qardl(y ~ x1 + x2, data = qardl_sim, tau = c(0.25, 0.50, 0.75), p = 2, q = 2) cat(qardl_table(fit, type = "text"))
Performs Wald tests for parameter constancy across quantiles in a QARDL model. Tests whether parameters are equal across different quantile levels.
qardl_wald( object, type = c("all", "beta", "phi", "gamma", "rho"), pairwise = FALSE )qardl_wald( object, type = c("all", "beta", "phi", "gamma", "rho"), pairwise = FALSE )
object |
An object of class |
type |
Character string specifying which parameters to test:
|
pairwise |
Logical. If |
The Wald test statistic is computed as:
where is a restriction matrix testing equality across quantiles,
is the vector of parameter estimates, and
is the estimated covariance matrix.
An object of class "qardl_wald" containing:
Data frame of test results with columns: test, statistic, df, pvalue
Data frame of pairwise test results (if pairwise = TRUE)
Type of test performed
Vector of quantiles
Cho, J.S., Kim, T.-H., & Shin, Y. (2015). Quantile cointegration in the autoregressive distributed-lag modeling framework. Journal of Econometrics, 188(1), 281-300. doi:10.1016/j.jeconom.2015.01.003
data(qardl_sim) fit <- qardl(y ~ x1 + x2, data = qardl_sim, tau = c(0.25, 0.50, 0.75), p = 2, q = 2) wald_results <- qardl_wald(fit) print(wald_results) # Pairwise tests wald_pairwise <- qardl_wald(fit, pairwise = TRUE) print(wald_pairwise)data(qardl_sim) fit <- qardl(y ~ x1 + x2, data = qardl_sim, tau = c(0.25, 0.50, 0.75), p = 2, q = 2) wald_results <- qardl_wald(fit) print(wald_results) # Pairwise tests wald_pairwise <- qardl_wald(fit, pairwise = TRUE) print(wald_pairwise)
Provides a detailed summary of QARDL estimation results including parameter estimates, standard errors, t-statistics, p-values, and diagnostic tests.
## S3 method for class 'qardl' summary(object, wald = TRUE, digits = 4, ...)## S3 method for class 'qardl' summary(object, wald = TRUE, digits = 4, ...)
object |
An object of class |
wald |
Logical. Include Wald tests for parameter constancy.
Default is |
digits |
Number of decimal places. Default is 4. |
... |
Additional arguments (unused). |
An object of class "summary.qardl" (invisibly).
Extract variance-covariance matrices from a QARDL model.
## S3 method for class 'qardl' vcov(object, type = c("all", "beta", "phi", "gamma"), ...)## S3 method for class 'qardl' vcov(object, type = c("all", "beta", "phi", "gamma"), ...)
object |
An object of class |
type |
Character. Which covariance to extract: |
... |
Additional arguments (unused). |
Array or list of covariance arrays.