Learn R Programming

paneltests (version 1.0.5)

xtcsdq: Tests of No Cross-Sectional Dependence in Panel Quantile Regressions

Description

Tests the null hypothesis of no cross-sectional error dependence (CSD) in panel quantile regressions. Implements the T_tau and T-tilde_tau statistics of Demetrescu, Hosseinkouchack and Rodrigues (2023).

Usage

xtcsdq(
  formula = NULL,
  data = NULL,
  index = NULL,
  quantiles,
  mode = c("pooled", "individual", "residuals"),
  residuals = NULL,
  bandwidth = NULL,
  correction = TRUE
)

Value

An object of class "xtcsdq" with components:

T_tau

Numeric vector of T_tau statistics (one per quantile).

Ttilde_tau

Numeric vector of bias-corrected T-tilde_tau statistics.

pval_T

p-values for T_tau.

pval_Ttilde

p-values for T-tilde_tau.

fhat

KDE density estimates at zero (one per quantile).

M_K

Portmanteau statistic (average of T_tau over quantiles).

Mtilde_K

Bias-corrected portmanteau statistic.

pval_M

p-value for M_K.

pval_Mc

p-value for Mtilde_K.

quantiles

Quantile levels used.

N

Number of cross-sectional units.

TT

Number of time periods.

bandwidth

KDE bandwidth used.

Arguments

formula

A formula of the form y ~ x1 + x2 + .... Required for mode = "pooled" (default) and mode = "individual". Not used when residuals is provided.

data

A data frame containing the panel data in long format. Required unless residuals is provided.

index

A character vector of length 2: c("id_var", "time_var"). Required unless residuals is provided.

quantiles

A numeric vector of quantile levels, each strictly between 0 and 1.

mode

Estimation mode: "pooled" (default, pooled FE-QR), "individual" (per-unit QR), or "residuals" (provide pre-computed residuals via the residuals argument).

residuals

A list (or named list) of numeric vectors or a matrix with one column per quantile, containing pre-computed QR residuals. Only used when mode = "residuals".

bandwidth

Numeric. KDE bandwidth for sparsity estimation. If NULL (default), uses \(0.35 (NT)^{-0.2}\).

correction

Logical. If TRUE (default), reports the bias-corrected T-tilde statistic in addition to T_tau.

Details

The T_tau statistic (Equation 3 in Demetrescu et al., 2023) tests for CSD by examining pairwise correlations of demeaned QR residuals across units. Under the null of no CSD, T_tau is asymptotically standard normal.

The bias-corrected version T-tilde_tau (Equation 5) subtracts two correction terms that account for the estimation uncertainty in the QR slope and the sparsity at the quantile. Reject H0 for large positive values.

The portmanteau statistic \(M_K = K^{-1} \sum_{q=1}^K T_\tau^{(q)}\) aggregates across K quantile levels.

The KDE bandwidth defaults to \(h = 0.35 (NT)^{-0.2}\) as in the original paper.

References

Demetrescu, M., Hosseinkouchack, M. and Rodrigues, P.M.M. (2023). Testing for No Cross-Sectional Error Dependence in Panel Quantile Regressions. Ruhr Economic Papers, No. 1041. tools:::Rd_expr_doi("10.4419/96973002")

Examples

Run this code
# \donttest{
set.seed(42)
n <- 8; tt <- 20
dat <- data.frame(
  id   = rep(1:n, each = tt),
  time = rep(1:tt, times = n),
  y    = rnorm(n * tt),
  x1   = rnorm(n * tt)
)
res <- xtcsdq(y ~ x1, data = dat, index = c("id", "time"),
              quantiles = c(0.25, 0.5, 0.75))
print(res)
summary(res)
# }

Run the code above in your browser using DataLab