The xtcspqardl package implements the
Cross-Sectionally Augmented Panel Quantile ARDL
(CS-PQARDL) model and the Quantile Common Correlated Effects
Mean Group (QCCEMG/QCCEPMG) estimator for panel data with
cross-sectional dependence.
install.packages("xtcspqardl")# install.packages("devtools")
devtools::install_github("muhammedalkhalaf/xtcspqardl")library(xtcspqardl)
# Generate 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)
)
# 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)
}
# Estimate QCCEMG
fit <- xtcspqardl(
formula = y ~ x,
data = data,
id = "id",
time = "time",
tau = c(0.25, 0.50, 0.75),
estimator = "qccemg"
)
# View results
summary(fit)# With long-run variables
fit_ardl <- xtcspqardl(
formula = y ~ dx | x, # dx is short-run, x is long-run
data = data,
id = "id",
time = "time",
tau = c(0.25, 0.50, 0.75),
estimator = "cspqardl",
p = 1,
q = 1
)
summary(fit_ardl)The CCE approach augments individual regressions with cross-sectional averages:
\[\bar{z}_t = \frac{1}{N} \sum_{i=1}^{N} z_{it}\]
where \(z\) includes both the dependent and independent variables.
\[y_{it} = \lambda_i(\tau) y_{i,t-1} + \beta_i(\tau)' x_{it} + \delta_i(\tau)' \bar{z}_t + u_{it}(\tau)\]
Long-run effects are computed as:
\[\theta(\tau) = \frac{\beta(\tau)}{1 - \lambda(\tau)}\]
Following Chudik & Pesaran (2015), the default lag order for CSA is:
\[p_T = \lfloor T^{1/3} \rfloor\]
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
Merwan Roudane - merwanroudane920@gmail.com
GPL (>= 3)