*! version 1.0.1 13feb2026

Title

xtbreakcoint -- Panel cointegration test with structural breaks and cross-section dependence

Version: 1.0.1
Date: 13 February 2026
Author: Dr Merwan Roudane (merwanroudane920@gmail.com)

Syntax

xtbreakcoint
depvar indepvars
[if] [in]
[, options]

Model
model(string) deterministic specification; default is trendshift

maxfactors(#) maximum number of common factors; default is 5

nofactor skip factor estimation entirely

ADF test
maxlag(#) maximum ADF lag order; default is 4

method(string) auto (t-sig at 10%) or fixed; default is auto

Estimation
trim(#) trimming fraction for break search; default is 0.15

maxiter(#) maximum iterations for factor estimation; default is 20

tolerance(#) convergence tolerance; default is 0.001

Output
graph display graph of estimated break dates

Description

xtbreakcoint implements the panel cointegration test of
Banerjee & Carrion-i-Silvestre (2015), which allows for
structural breaks and cross-section dependence via common factors.

The test proceeds in five steps:

1. For each panel unit, estimate the cointegrating regression
in first differences, searching for the optimal break date that
minimizes the sum of squared residuals over [trim*T, (1-trim)*T].

2. Extract common factors from the residual matrix via PCA
(principal component analysis) using the Bai & Ng (2002) IC1
information criterion to determine the number of factors.

3. Iterate: given factors, re-estimate breaks; given breaks,
re-estimate factors — until the SSR converges.

4. Run individual ADF tests on the idiosyncratic residuals
(after removing common factors). Test for common stochastic trends
using the Bai & Ng (2004) MQ test (both non-parametric and parametric).

5. Construct the panel test statistic:

Z_t = sqrt(N) * (tbar - E[t]) / sqrt(Var[t])

where tbar is the average of the individual ADF statistics,
and E[t] and Var[t] are empirical moments tabulated under H0.

Under H0 (no cointegration), Z_t ~ N(0,1).
Reject H0 for sufficiently negative Z_t values (one-sided test).

Options

Model

model(string) specifies the deterministic component.
Options are:

constant (or 1) — constant only (Pedroni-type)

trend (or 2) — constant + time trend

levelshift (or 3) — constant + level shift

trendshift (or 4) — constant + trend + level shift [default]

regimeshift (or 5) — constant + trend + level + slope shift

maxfactors(#) sets the maximum number of common factors
to extract. Set to 0 or use nofactor to skip factor estimation.

ADF test

maxlag(#) sets the maximum lag order for the individual ADF tests.

method(string) selects the lag order selection method:
auto (default) uses the general-to-specific t-significance approach
(drop the last lag if |t| < 1.645);
fixed uses all lags up to maxlag.

Estimation

trim(#) sets the trimming fraction for the break date search.
Break dates are searched over [trim*T, (1-trim)*T]. Default: 0.15.

maxiter(#) maximum number of iterations for the
factor-break estimation algorithm. Default: 20.

tolerance(#) convergence tolerance. The algorithm stops
when the absolute change in SSR between iterations falls below
this value. Default: 0.001.

Deterministic Models

The five deterministic specifications correspond to different
assumptions about the data generating process:

Model Deterministic terms

constant mu_i

trend mu_i + delta_i * t

levelshift mu_i + theta_i * DU_it

trendshift mu_i + delta_i * t + theta_i * DU_it

regimeshift mu_i + delta_i * t + theta_i * DU_it + gamma_i * DT_it

where DU_it = I(t > T_b,i) is the level shift dummy and
DT_it = (t - T_b,i) * I(t > T_b,i) is the slope shift dummy.

MQ Test for Common Stochastic Trends

When common factors are detected, xtbreakcoint automatically
performs the Bai & Ng (2004) MQ test to determine the number of
common stochastic trends among the estimated factors.

Two versions of the test are computed:

Non-parametric MQ: Uses Newey-West long-run covariance
estimation with bandwidth bigJ = 4*ceil((min(T,N)/100)^(1/4)).
No short-run dynamics are removed.

Parametric MQ: Estimates a VAR(p) on the rotated factors
to filter out short-run dynamics, then computes the test statistic
on the filtered series. The VAR order is selected using BIC.

Both tests use the sequential procedure of Bai & Ng (2004):
starting from r* = r (the number of factors), the null hypothesis
of r* common trends is tested at 5% level. If rejected, r* is
decremented and the test is repeated until the null is not rejected.

Critical values are from Bai & Ng (2004, Econometrica), Table I.
For Model 5 (regime shift), T-dependent critical values are used.

Cross-section dependence (CD) testing can be performed separately
using existing Stata commands:

. xtcsd, pesaran (Pesaran 2004 CD test)

. xtcd2 (Pesaran 2015 weak CD test)

Examples

Using the replication data

The file xtbreakcoint_example.xlsx contains the original
data from Banerjee & Carrion-i-Silvestre (2015): log import prices,
log foreign prices, and log exchange rates for 10 European countries,
9 sectors, monthly 1995m1-2005m3.

Load the sector 0 data:

. import excel "xtbreakcoint_example.xlsx", sheet("sector0") firstrow clear

. encode country, gen(id)

. xtset id t

Basic test — trend shift model (default, matching GAUSS model=4):

. xtbreakcoint lpm lfp lexrate, model(trendshift) maxlag(12)

Constant model (no break):

. xtbreakcoint lpm lfp lexrate, model(constant)

Level shift model with automatic lag selection:

. xtbreakcoint lpm lfp lexrate, model(levelshift) maxlag(12)

Regime shift model with graph:

. xtbreakcoint lpm lfp lexrate, model(regimeshift) maxlag(12) graph

No factor estimation (ignore cross-section dependence):

. xtbreakcoint lpm lfp lexrate, model(trendshift) nofactor

Access stored results:

. di "Z_t = " r(Z_t) ", p-value = " r(p_value)

. di "Common factors = " r(nfactors) ", stochastic trends = " r(n_trends)

. mat list r(adf)

. mat list r(breaks)

Stored results

xtbreakcoint stores the following in r():

Scalars

r(Z_t) panel Z_t test statistic

r(p_value) one-sided p-value

r(tbar) average of individual ADF statistics

r(mean_t) E[t] under H0

r(var_t) Var[t] under H0

r(N) number of panels

r(T) number of time periods

r(nfactors) number of detected common factors

r(n_trends) common stochastic trends (non-parametric MQ)

r(MQ_np) non-parametric MQ test statistic (Bai & Ng 2004)

r(n_trends_p) common stochastic trends (parametric MQ)

r(MQ_p) parametric MQ test statistic (Bai & Ng 2004)

r(iterations) number of convergence iterations

r(reject_pct) individual rejection rate (%)

Matrices

r(adf) (Nx1) individual ADF statistics

r(lags) (Nx1) selected lag orders

r(breaks) (Nx1) estimated break dates

Macros

r(model) deterministic model used

r(depvar) dependent variable

r(indepvars) independent variables

r(method) lag selection method

References

Banerjee, A. and J.L. Carrion-i-Silvestre (2015).
"Cointegration in panel data with structural breaks and
cross-section dependence."
Journal of Applied Econometrics 30(1): 1–22.
https://doi.org/10.1002/jae.2348

Bai, J. and S. Ng (2002). "Determining the number of factors in
approximate factor models."
Econometrica 70(1): 191–221.

Bai, J. and S. Ng (2004). "A PANIC attack on unit roots and
cointegration."
Econometrica 72(4): 1127–1177.

Pesaran, M.H. (2004). "General diagnostic tests for cross section
dependence in panels."
Cambridge Working Papers in Economics 0435.

Pedroni, P. (1999). "Critical values for cointegration tests in
heterogeneous panels with multiple regressors."
Oxford Bulletin of Economics and Statistics 61(S1): 653–670.

Author

Dr Merwan Roudane

Email: merwanroudane920@gmail.com

Translated from original GAUSS code by:

Anindya Banerjee and Josep Lluís Carrion-i-Silvestre

Department of Econometrics, University of Barcelona

Please cite as:

Roudane, M. (2026). "xtbreakcoint: Panel cointegration test with structural breaks
and cross-section dependence in Stata." Version 1.0.1.