Package 'xtcspqardl'

Title: Cross-Sectionally Augmented Panel Quantile ARDL
Description: Implements the Cross-Sectionally Augmented Panel Quantile Autoregressive Distributed Lag (CS-PQARDL) model and the Quantile Common Correlated Effects Mean Group (QCCEMG) estimator for panel data with cross-sectional dependence. The package handles unobserved common factors through cross-sectional averages following Pesaran (2006) <doi:10.1111/j.1468-0262.2006.00692.x> and Chudik and Pesaran (2015) <doi:10.1016/j.jeconom.2015.03.007>. Quantile regression for dynamic panels follows Harding, Lamarche, and Pesaran (2018) <doi:10.1016/j.jeconom.2018.07.010>. The ARDL approach to cointegration testing is based on Pesaran, Shin, and Smith (2001) <doi:10.1002/jae.616>.
Authors: Muhammad Alkhalaf [aut, cre, cph] (ORCID: <https://orcid.org/0009-0002-2677-9246>)
Maintainer: Muhammad Alkhalaf <[email protected]>
License: GPL-3
Version: 1.0.2
Built: 2026-05-28 07:22:14 UTC
Source: https://github.com/muhammedalkhalaf/xtcspqardl

Help Index


Extract coefficients from xtcspqardl object

Description

Extract coefficients from xtcspqardl object

Usage

## S3 method for class 'xtcspqardl'
coef(object, tau = NULL, type = "short_run", ...)

Arguments

object

An object of class "xtcspqardl".

tau

Optional quantile(s) to extract. If NULL, returns all.

type

Character; "short_run" or "long_run".

...

Additional arguments (ignored).

Value

Named numeric vector or list of coefficients.


Compute Cross-Sectional Averages

Description

Computes cross-sectional averages (CSA) of all variables at each time period, following the CCE approach of Pesaran (2006).

Usage

compute_csa(data, id, time, depvar, indepvars, cr_lags = 0)

Arguments

data

Data frame with panel data.

id

Character string naming the cross-sectional identifier.

time

Character string naming the time variable.

depvar

Character string naming the dependent variable.

indepvars

Character vector of independent variable names.

cr_lags

Integer number of lags for CSA (Chudik & Pesaran, 2015).

Details

Cross-sectional averages are computed as:

zˉt=1Ni=1Nzit\bar{z}_t = \frac{1}{N} \sum_{i=1}^{N} z_{it}

for each variable zz in {y,x1,x2,...}\{y, x_1, x_2, ...\}.

Following Chudik and Pesaran (2015), lagged CSA are included with default lag order floor(T^{1/3}).

Value

A list containing:

data

Data frame with CSA columns added.

csa_vars

Character vector of CSA variable names.

References

Chudik, A. and Pesaran, M.H. (2015). Common Correlated Effects Estimation of Heterogeneous Dynamic Panel Data Models with Weakly Exogenous Regressors. Journal of Econometrics, 188(2), 393-420. doi:10.1016/j.jeconom.2015.03.007

Pesaran, M.H. (2006). Estimation and Inference in Large Heterogeneous Panels with a Multifactor Error Structure. Econometrica, 74(4), 967-1012. doi:10.1111/j.1468-0262.2006.00692.x


Fitted values from xtcspqardl model

Description

Fitted values from xtcspqardl model

Usage

## S3 method for class 'xtcspqardl'
fitted(object, ...)

Arguments

object

An object of class "xtcspqardl".

...

Additional arguments (ignored).

Value

This function is not yet implemented for xtcspqardl objects.


Print method for summary.xtcspqardl

Description

Print method for summary.xtcspqardl

Usage

## S3 method for class 'summary.xtcspqardl'
print(x, digits = 4, signif.stars = TRUE, ...)

Arguments

x

An object of class "summary.xtcspqardl".

digits

Number of significant digits.

signif.stars

Logical; print significance stars.

...

Additional arguments (ignored).

Value

Invisibly returns the input object.


Print method for xtcspqardl objects

Description

Print method for xtcspqardl objects

Usage

## S3 method for class 'xtcspqardl'
print(x, ...)

Arguments

x

An object of class "xtcspqardl".

...

Additional arguments (ignored).

Value

Invisibly returns the input object.


Residuals from xtcspqardl model

Description

Residuals from xtcspqardl model

Usage

## S3 method for class 'xtcspqardl'
residuals(object, ...)

Arguments

object

An object of class "xtcspqardl".

...

Additional arguments (ignored).

Value

This function is not yet implemented for xtcspqardl objects.


Summary method for xtcspqardl objects

Description

Summary method for xtcspqardl objects

Usage

## S3 method for class 'xtcspqardl'
summary(object, ...)

Arguments

object

An object of class "xtcspqardl".

...

Additional arguments (ignored).

Value

An object of class "summary.xtcspqardl".


Extract variance-covariance matrix from xtcspqardl object

Description

Extract variance-covariance matrix from xtcspqardl object

Usage

## S3 method for class 'xtcspqardl'
vcov(object, tau = NULL, ...)

Arguments

object

An object of class "xtcspqardl".

tau

Optional quantile to extract. If NULL, returns all.

...

Additional arguments (ignored).

Value

Variance-covariance matrix or list of matrices.


Cross-Sectionally Augmented Panel Quantile ARDL

Description

Estimates the Cross-Sectionally Augmented Panel Quantile ARDL (CS-PQARDL) model or the Quantile Common Correlated Effects Mean Group (QCCEMG/QCCEPMG) estimator for panel data with cross-sectional dependence.

Usage

xtcspqardl(
  formula,
  data,
  id,
  time,
  tau = 0.5,
  estimator = c("qccemg", "qccepmg", "cspqardl"),
  p = 1L,
  q = 1L,
  cr_lags = NULL,
  constant = TRUE,
  model = c("pmg", "mg", "dfe")
)

Arguments

formula

A formula of the form y ~ x1 + x2 | z1 + z2 where variables before | are short-run regressors and variables after | are long-run regressors (for CS-PQARDL). For QCCEMG, use

y ~ x1 + x2.

data

A data frame containing panel data.

id

Character string naming the cross-sectional unit identifier.

time

Character string naming the time variable.

tau

Numeric vector of quantiles to estimate (between 0 and 1).

estimator

Character string specifying the estimator: "qccemg" for Quantile CCE Mean Group (default), "qccepmg" for Quantile CCE Pooled Mean Group, "cspqardl" for CS Panel Quantile ARDL.

p

Integer specifying the number of lags for the dependent variable (default 1, for CS-PQARDL).

q

Integer or vector specifying the number of lags for each regressor (default 1, for CS-PQARDL).

cr_lags

Integer specifying the number of lags for cross-sectional averages. Default is floor(T^(1/3)) following Chudik and Pesaran (2015).

constant

Logical; if TRUE (default), include a constant term.

model

Character string for CS-PQARDL pooling: "pmg" for Pooled Mean Group (default), "mg" for Mean Group, "dfe" for Dynamic Fixed Effects.

Details

The package implements two main estimators for panel quantile regression with cross-sectional dependence:

QCCEMG (Quantile CCE Mean Group): Estimates unit-by-unit quantile regressions augmented with cross-sectional averages, then aggregates using mean group estimator. The model is:

yit=λiyi,t1+βixit+δizˉt+uity_{it} = \lambda_i y_{i,t-1} + \beta_i' x_{it} + \delta_i' \bar{z}_t + u_{it}

where zˉt\bar{z}_t contains cross-sectional averages of yy and xx.

CS-PQARDL (CS Panel Quantile ARDL): Extends the ARDL approach to cointegration (Pesaran, Shin & Smith, 2001) to quantile regression with CCE augmentation. Estimates error-correction form with long-run relationships.

Cross-sectional dependence is handled through the CCE approach (Pesaran, 2006), which augments regressions with cross-sectional averages of all variables. Lagged CSA follow Chudik & Pesaran (2015) with default floor(T^{1/3}) lags.

Value

An object of class "xtcspqardl" containing:

coefficients

Mean group coefficients across panels.

se

Standard errors using mean group variance.

vcov

Variance-covariance matrix.

individual

List of unit-specific estimates.

long_run

Long-run coefficient estimates.

speed_adj

Speed of adjustment coefficients.

half_life

Half-life of adjustment.

tau

Quantiles estimated.

call

The matched call.

formula

The formula used.

n_panels

Number of panels.

n_obs

Total observations.

avg_T

Average time periods per panel.

References

Chudik, A. and Pesaran, M.H. (2015). Common Correlated Effects Estimation of Heterogeneous Dynamic Panel Data Models with Weakly Exogenous Regressors. Journal of Econometrics, 188(2), 393-420. doi:10.1016/j.jeconom.2015.03.007

Harding, M., Lamarche, C., and Pesaran, M.H. (2018). Common Correlated Effects Estimation of Heterogeneous Dynamic Panel Quantile Regression Models. Journal of Applied Econometrics, 35(3), 294-314. doi:10.1016/j.jeconom.2018.07.010

Pesaran, M.H. (2006). Estimation and Inference in Large Heterogeneous Panels with a Multifactor Error Structure. Econometrica, 74(4), 967-1012. doi:10.1111/j.1468-0262.2006.00692.x

Pesaran, M.H., Shin, Y., and Smith, R.J. (2001). Bounds Testing Approaches to the Analysis of Level Relationships. Journal of Applied Econometrics, 16(3), 289-326. doi:10.1002/jae.616

Examples

# Generate example panel data
set.seed(123)
N <- 20  # panels
T <- 50  # time periods
data <- data.frame(
  id = rep(1:N, each = T),
  time = rep(1:T, N),
  x = rnorm(N * T),
  y = rnorm(N * T)
)
# Add dynamics
for (i in 1:N) {
  idx <- ((i-1)*T + 2):(i*T)
  data$y[idx] <- 0.5 * data$y[idx-1] + 0.3 * data$x[idx] + rnorm(T-1, sd=0.5)
}

# QCCEMG estimation
fit <- xtcspqardl(y ~ x, data = data, id = "id", time = "time",
                  tau = c(0.25, 0.50, 0.75), estimator = "qccemg")
summary(fit)