*! version 1.1.0 11may2026

Title

xtcsb -- Multifactor cross-sectionally augmented panel unit
root tests of CIPS* and CSB (Pesaran, Smith & Yamagata 2013)

Syntax

xtcsb depvar [addregs] [if] [in]
[,
maxlags(#)
trend
kregs(#)
notable
nograph
level(#)
cipsonly
csbonly
export(filename)
saving(filename)]

xtcsb requires the data to be tsset as a balanced panel without gaps.

depvar is the variable tested for a unit root. addregs is an
optional list of additional regressors x_it that share the same
unobserved common factors as depvar, used to augment the
cross-sectional projections. The rank condition requires k >=
m0 - 1 where m0 is the unknown number of
common factors.

Description

xtcsb implements the two panel unit root tests proposed by Pesaran,
Smith & Yamagata (2013, Journal of Econometrics 175, 94-115) for
panels with a multifactor error structure:

CIPS*: a truncated average of cross-sectionally augmented
Dickey-Fuller (CADF) t-ratios. Generalises the test of Pesaran
(2007) by adding the cross-section averages of k additional
observable variables to handle m0 >= 1 unobserved
factors.

CSB: a cross-sectionally augmented Sargan-Bhargava test based on
the partial sums of the residuals from an augmented first-difference
regression. CSB has typically higher power than CIPS for small to
moderate T.

Both tests are left-tailed: H0 is rejected when the statistic is
smaller than the critical value.

Output includes a detailed table (specification block, panel test
results, individual unit statistics) and a 4-panel publication-quality
dashboard (CADF forest plot, CSB forest plot, kernel density and
CIPS-CSB scatter).

Options

maxlags(#) sets the lag-augmentation order p in the CADF and CSB
regressions. If unspecified, p_hat = floor[4(T/100)^{1/4}] is used,
following Pesaran et al. (2013, Section 4).

trend adds a unit-specific linear trend (Case III). The default is
intercept only (Case II / model with constant).

kregs(#) specifies the number of additional regressors to use.
It is overridden if addregs is supplied (k is then inferred from
the number of variables provided).

notable suppresses the formatted display.

nograph suppresses the 4-panel dashboard.

level(#) confidence level for reporting (default 95).

cipsonly reports CIPS* only (hides CSB).

csbonly reports CSB only (hides CIPS*).

export(filename) writes a tidy CSV of per-unit and panel results.

saving(filename) saves the combined dashboard graph (any format
supported by graph export: .png, .pdf, .gph, .svg).

Method

For each cross-sectional unit i, the CADF regression is
(PSY 2013, eq. 14 / 39):

||delta y_ = a_i + b_i y_ + c'_i zbar_
+ sum_ h'_ delta zbar_
+ sum_ g_ delta y_ + (g_i*t) + e_||

where zbar_t = N^{-1} sum_j (y_, x'_)'. The CIPS statistic is
the average of t-ratios on b_i. The truncated version CIPS* (eq. 30)
caps individual t-ratios at -K1 and +K2 (K1, K2 from Pesaran 2007
Table I).

For CSB, the augmented first-difference regression (PSY 2013, eq. 35)
omits the level term:

||delta y_ = (a_i +) sum_ h'_ delta zbar_
+ sum_ g_ delta y_ + e_||

and CSB_i = T^{-2} sum_t (sum_ ehat_)^2 / sigma_i^2.

Critical values are interpolated from Pesaran et al. (2013) Tables
B.1-B.4 (intercept) and B.2/B.4 (intercept + trend), with k-specific
shifts calibrated against the empirical-application anchor points in
Tables 4-5 of the paper.

Stored results

r(CIPS) truncated CIPS* statistic

r(CIPS_untrunc) untruncated CIPS statistic

r(CSB) CSB statistic

r(N) number of panels

r(T) number of time periods

r(k) number of additional regressors

r(p) lag-augmentation order

r(cips_cv1/5/10) CIPS 1/5/10% critical values

r(csb_cv1/5/10) CSB 1/5/10% critical values

r(trunc_n) number of truncated units

r(cips_decision) decision text for CIPS

r(csb_decision) decision text for CSB

r(results) matrix of per-unit statistics
(columns: id, CADF_i, CADF_i*, CSB_i, p_lag, rej_cips, rej_csb)

Examples

Setup a balanced panel:

. webuse grunfeld, clear

. tsset company year

Basic test on invest with intercept, default lag:

. xtcsb invest

Test with intercept and trend, 2 augmentation lags, save graph:

. xtcsb invest, trend maxlags(2) saving(dash.png)

Test using mvalue and kstock as additional regressors
sharing the common factors of invest:

. xtcsb invest mvalue kstock, trend

Export tidy CSV of unit and panel results:

. xtcsb invest mvalue, export(invest_csb.csv)

Display only CSB (preferred for small T):

. xtcsb invest, csbonly maxlags(1)

References

Pesaran, M.H. 2007. A simple panel unit root test in the presence of
cross-section dependence. Journal of Applied Econometrics 22(2),
265-312.

Pesaran, M.H., L.V. Smith, T. Yamagata. 2013. Panel unit root tests in
the presence of a multifactor error structure. Journal of
Econometrics 175, 94-115.
doi

Bai, J., S. Ng. 2010. Panel unit root tests with cross-section
dependence: a further investigation. Econometric Theory 26,
1088-1114.

Author

Dr. Merwan Roudane

Email: merwanroudane920@gmail.com

Suggestions and bug reports are welcome.