*! version 1.0.0 20jun2026 Dr Merwan Roudane

Title

xtpqcce -- Heterogeneous panel quantile regression with Common
Correlated Effects: the dynamic QCCEMG estimator (Harding, Lamarche & Pesaran,
2018) and the convolution-smoothed CCEMG-CSQR estimator with two-step bias
correction (Zhang & Su, 2026)

Syntax

xtpqcce depvar indepvars [if] [in],
quantiles(numlist)
[estimator options]

where estimator selects the method:

qmg Quantile CCE Mean Group - dynamic
(lagged depvar), standard quantile regression. Harding, Lamarche & Pesaran
(2018). This is the default.

csqr Convolution-Smoothed Quantile CCE Mean Group
(CCEMG-CSQR) - static, smooth and convex objective, optional
two-step bias correction. Zhang & Su (2026).

options

Model
quantiles(numlist) quantile indices in (0,1); required.
e.g. quantiles(0.1(0.1)0.9)

lags(#) number of lags of depvar (qmg only; default 1)

crlags(#) number of lags of the cross-sectional averages
(p_T; default floor(Tbar^(1/3)) )

deterministics(varlist) extra observed common factors d_t
(trend, dummies) for csqr

noconstant suppress the constant term

CSQR estimation and bias correction
bc apply the two-step bias correction
(smoothing-bias + split-panel jackknife)

c0(#) bandwidth tuning constant (default 0.5)

bwidth(#) fix the bandwidth manually (disables the automatic rule)

jbw(#) number of bandwidths used in the smoothing-bias step (default 11)

Reporting and graphics
lrun also tabulate the long-run effects beta/(1-lambda) (qmg)

level(#) set the confidence level; default level(95)

graph draw the quantile-process figure (one panel per regressor)

graphexport(filename) save that figure to filename

notable suppress the coefficient tables

nodots suppress the per-panel progress dots

The data must be declared a panel with xtset panelvar timevar.
depvar and indepvars may contain time-series operators. xtpqcce
is suitable for medium-to-large N and T panels with cross-sectional
dependence and heterogeneous slopes.

Description

xtpqcce estimates heterogeneous panel quantile regression models in
which the units are linked by unobserved common factors (interactive fixed
effects) and therefore exhibit cross-sectional dependence. It implements the
Common Correlated Effects (CCE) idea of Pesaran (2006): the unobserved
factors are proxied by cross-sectional averages of the dependent variable and
the regressors,

z-bart = ( y-bart , x-bart' )' ,

which (together with p_T of their lags) are added to a unit-by-unit
quantile regression. The unit-specific slope estimates are then averaged into a
mean-group (MG) estimator and reported for each requested quantile, so the
researcher recovers the distributional effect of each covariate -
how its impact differs at the lower tail, the median, and the upper tail of the
conditional distribution of depvar.

Two estimators are provided. Both share the same CCE augmentation and the same
mean-group inference philosophy, but they target different model classes:

qmg - the QCCEMG estimator of Harding, Lamarche &
Pesaran (2018), for dynamic models containing a lagged dependent variable.
Each unit is estimated by ordinary quantile regression (qreg) of
y_it on its own lag(s), x_it, and the augmenting averages. The
parameters of interest are the persistence lambda(tau) and the short-run slopes
beta(tau); the command also reports the long-run effects
beta(tau)/(1-lambda(tau)) and the implied half-lives.

csqr - the CCEMG-CSQR estimator of Zhang & Su (2026),
for static models, specifically designed to remain valid when the time
dimension T is relatively small compared with N. Each unit is
estimated by convolution-smoothed quantile regression (a Gaussian kernel
makes the check-function objective smooth and convex), and the mean-group
estimate can be bias-corrected in two steps to remove the smoothing bias
and the incidental-parameter bias. This is the appropriate choice when
N/T is large (a common situation in applied panels).

Results are presented in journal-style tables with significance stars and
confidence intervals, and can be visualised as quantile-process plots
(coefficient against tau with a shaded pointwise confidence band). All estimates
are saved in e() and the headline slopes are posted in e(b)/e(V)
so that test, lincom and nlcom work.

Which estimator should I use?

A short decision guide:

Question Use

Does the model contain a lagged dependent variable / dynamics? qmg

Static model, and T is small relative to N (say N/T > 2)? csqr, bc

Static model, and T is comparable to or larger than N? csqr (bias correction optional)

You want short- and long-run distributional effects? qmg with lrun

You need a smooth, globally optimised objective? csqr

Both estimators require T to be reasonably large for the within-unit
quantile regressions to be well behaved; with very short T prefer
csqr with bc, whose theory is built for that case. As a rough rule,
aim for T of at least 20-25 and at least (1 + #regressors)(1 + p_T) + a few
usable time periods per unit after the lags are taken.

Options

Model

quantiles(numlist) (required) lists the quantile indices, each
strictly inside (0,1). Examples: quantiles(0.5) (median only),
quantiles(0.1 0.25 0.5 0.75 0.9), or quantiles(0.05(0.05)0.95) for a
full quantile process. More quantiles give a smoother picture but take longer
(especially with bc).

lags(#) sets the number of lags of depvar entering the dynamic
model (qmg only; default 1, the AR(1) specification of HLP 2018). The
reported persistence lambda is the sum of the AR coefficients.

crlags(#) sets p_T, the number of lags of the cross-sectional
averages used to approximate the factors, following Chudik & Pesaran (2015). The
default floor(Tbar^(1/3)) is the standard rule. The first p_T time periods
of each panel are dropped from estimation (they have no complete proxy history).
Increasing p_T improves the factor approximation but costs degrees of
freedom; reduce it if many panels fail to estimate.

deterministics(varlist) adds observed common deterministics
d_t (for example a linear trend or seasonal dummies) to the CCE-augmented
regression in the csqr estimator. The constant is always included unless
noconstant is specified.

CSQR estimation and bias correction

bc requests the two-step bias correction for csqr, and is
the headline estimator of Zhang & Su (2026). Step 1 removes the O(h^2)
smoothing bias by combining mean-group estimates computed at J different
bandwidths (Lin & Li 2008; Cheng et al. 2018). Step 2 removes the O(1/T)
incidental-parameter bias with a split-panel jackknife over the two halves
of the time dimension (Dhaene & Jochmans 2015). Use bc whenever N/T
is large; it is essential for correctly-sized confidence intervals there.

c0(#) is the tuning constant c0 in the bandwidth rule (default 0.5,
the value recommended by Zhang & Su). Smaller c0 brings the estimator closer to
its non-smoothed counterpart and is generally more stable; larger c0 smooths
more.

bwidth(#) fixes the bandwidth at a user-supplied value, overriding
the automatic rule. Mainly for sensitivity analysis.

jbw(#) is the number of bandwidths J used in the smoothing-bias
step (default 11, with c_j = 0.5, 0.6, ..., 1.5, as in the paper).

Reporting and graphics

lrun additionally tabulates the long-run effects
theta(tau) = beta(tau)/(1-lambda(tau)), with nonparametric mean-group inference
based on the distribution of the unit-level theta_i(tau) (qmg only).

graph draws one panel per regressor showing the mean-group (or
bias-corrected) coefficient across the quantiles, with a shaded pointwise
confidence band and a zero reference line. Combine with graphexport() to
save it. See xtpqcce_graph for redrawing and styling.

level(#), notable, nodots behave as usual.

Methods and formulas

Model. For unit i and time t, the tau-th conditional
quantile of y_it is

Q(tau) = a_i(tau) + lambda_i(tau) y_ + x_it' beta_i(tau)
+ f_t' g_i(tau),

where f_t is a vector of unobserved common factors with
heterogeneous loadings g_i. The slopes (lambda_i, beta_i) and the loadings
are unit-specific (full slope heterogeneity).

CCE augmentation. Because f_t is unobserved, it is proxied by the
cross-sectional averages z-bar_t = (y-bar_t, x-bar_t')' and their first p_T
lags (Pesaran 2006; Chudik & Pesaran 2015). Each unit-level quantile regression
is augmented with these proxies, which absorb the common factors and the
resulting cross-sectional dependence.

QMG (HLP 2018). For each unit and quantile, qreg fits

y_it = a_i + lambda_i y_ + x_it' beta_i
+ sum_l z-bar_' d_il + e_it .

The mean group is the simple average over units,
theta-hat(tau) = (1/N) sum_i theta-hat_i(tau), with theta_i = (lambda_i,
beta_i')'. Inference uses the nonparametric mean-group variance
V = (N-1)^(-1) sum_i (theta_i - theta-bar)(theta_i - theta-bar)', and
the reported standard errors are sqrt(diag(V)/N). Long-run effects use the
unit-level theta_i = beta_i/(1-lambda_i) and the same nonparametric MG variance
(this is exact in spirit and avoids delta-method approximations). The half-life
is ln(0.5)/ln(|lambda|).

CCEMG-CSQR (Zhang & Su 2026). Each unit is fitted by minimising the
convolution-smoothed objective
(1/T) sum_t m_(y_it - beta'x_it - eta'z-bar_t^a), where
m_ = rho_tau * K_h is the check function convolved with a Gaussian kernel
of bandwidth h. The objective is smooth and convex and is solved by
Newton-Raphson. The bandwidth follows
h = c0 * min(s_u, IQR_u/1.34898) * T^(-7/24) (their eq 4.1), where s_u and
IQR_u are the spread of the fitted residuals. The mean-group estimate is
beta^MG = (1/N) sum_i beta_i. With bc the two-step correction of
their Section 3.3 is applied. Inference uses
Omega-hat = (1/N) sum_i (beta_i - beta^bc)(beta_i - beta^bc)' and
CI = S'beta^bc +/- z * sqrt(S'Omega-hat S / N) (their eq 3.11-3.12).

Implementation note. The Newton solver uses a generalized inverse, a
tiny data-scaled ridge, and step-damping. These are numerical safeguards only:
the smoothed objective is convex, so the solver converges to the same optimum;
they merely keep the iteration stable when the cross-sectional-average block is
near-collinear. The estimator, bandwidth, and inference are exactly as in the
papers.

Practical guidance

How many quantiles? For a process plot use a fine grid
(quantiles(0.05(0.05)0.95)); for a compact table use the tails and the
median (0.1 0.25 0.5 0.75 0.9). Avoid the extreme tails (below 0.05 or
above 0.95) unless T is large.

Lags of the averages (p_T). Start from the default. If panels fail
to estimate ("N_eff" < N), T is probably too short for the chosen p_T;
lower crlags(). If strong dynamics remain in the residuals, raise it.

Bias correction. Switch bc on when N/T is large; the
uncorrected estimator can be markedly under-covered there (Zhang & Su, Table
2-4). When T is comparable to N, bc changes little but is
harmless. Note bc refits the model many times (J bandwidths x split-panel
jackknife), so it is slower.

Bandwidth. The default rule is robust; you rarely need bwidth().
For a sensitivity check, vary c0() over, say, 0.3-0.8 and confirm the
estimates are stable.

Diagnostics. Inspect e(b_i) (one row per unit) to study slope
heterogeneity, and watch the reported number of successfully estimated panels.
Cross-sectional dependence and slope heterogeneity are the motivation for this
command; if both are absent, a pooled panel quantile estimator may suffice.

Reading the output

Mean-group coefficient table - the distributional slope of
each x at each quantile, with z-statistic, p-value, CI and stars. A
coefficient that rises (falls) across tau means the covariate widens (narrows)
the conditional distribution of depvar.

Persistence table (qmg) - lambda(tau) and its half-life.
Larger |lambda| means more persistent dynamics (slower mean reversion); the
label flags low/moderate/persistent/non-stationary behaviour.

Long-run table (qmg, with lrun) - the cumulative
effect beta/(1-lambda) once the dynamics have played out, with nonparametric MG
inference.

Examples

Declare the panel

. xtset country year

Static CCEMG-CSQR across five quantiles, bias-corrected, with a plot

. xtpqcce co2 gdp energy, csqr quantiles(0.1 0.25 0.5 0.75 0.9) bc graph

Full quantile process, saved to file

. xtpqcce co2 gdp energy, csqr quantiles(0.05(0.05)0.95) bc graph graphexport(fig1.png)

Dynamic QCCEMG with short-run, persistence and long-run effects

. xtpqcce y x1 x2, qmg quantiles(0.25 0.5 0.75) lags(1) lrun graph

Test whether the upper-tail effect of x1 differs from the lower tail

. test [q90]x1 = [q10]x1

CCEMG-CSQR with a deterministic trend in d_t and more factor lags

. xtpqcce y x1 x2, csqr quantiles(0.5) det(c.year) crlags(4)

Stored results

xtpqcce stores the following in e():

Scalars

e(N) observations used

e(N_g) number of panels

e(g_valid) panels successfully estimated

e(Tbar), e(Tmin) average / minimum panel length

e(k), e(ntau) # regressors / # quantiles

e(crlags), e(lags) CSA lags p_T / dynamic lags

e(bw), e(c0) bandwidth / tuning constant (csqr)

e(level) confidence level

Macros

e(cmd) xtpqcce

e(estimator) qmg or csqr

e(biascorr) twostep if bc was used

e(depvar), e(indepvars), e(tau) model contents

e(ivar), e(tvar) panel and time variables

Matrices

e(b), e(V) headline slopes, one equation per quantile (qXX)

e(mg) mean-group estimates (beta; and lambda for qmg)

e(V_mg), e(SE) MG covariance and standard errors

e(b_i) per-unit beta estimates (one row per panel)

e(bc_mg) bias-corrected MG (csqr with bc)

e(lr_mg), e(lr_SE), e(lr_V) long-run effects (qmg)

e(lr_i), e(hl_mg) per-unit long-run / half-lives (qmg)

References

Chudik, A. and M. H. Pesaran. 2015. Common correlated effects estimation
of heterogeneous dynamic panel data models with weakly exogenous regressors.
Journal of Econometrics 188: 393-420.

Dhaene, G. and K. Jochmans. 2015. Split-panel jackknife estimation of
fixed-effect models. Review of Economic Studies 82: 991-1030.

Fernandes, M., E. Guerre and E. Horta. 2021. Smoothing quantile
regressions. Journal of Business & Economic Statistics 39: 338-357.

Harding, M., C. Lamarche and M. H. Pesaran. 2018. Common Correlated
Effects estimation of heterogeneous dynamic panel quantile regression models.
USC Dornsife INET Working Paper 18-11.

Pesaran, M. H. 2006. Estimation and inference in large heterogeneous
panels with a multifactor error structure. Econometrica 74: 967-1012.

Zhang, M. and L. Su. 2026. CCE estimation of heterogeneous panel quantile
regression models with relatively small T. Journal of Business & Economic
Statistics, forthcoming. doi: 10.1080/07350015.2026.2641575.

Author

Dr Merwan Roudane

merwanroudane920@gmail.com

github.com/merwanroudane

Please cite the two methodological papers above when using xtpqcce.