*! xtgunitroot version 1.0.0 28jun2026

Title

xtgunitroot -- Generalized fixed-T panel unit root test (doubly modified estimator)

Syntax

xtgunitroot
varname
[if] [in]
[,
options]

Model
model(spec) deterministic specification: intercept (default)
or break

break(#) break point for break: a date, a fraction in (0,1),
or unknown

maxlag(p) maximum order of serial correlation to be robust to; default 0

Unknown-break bootstrap
breps(#) bootstrap replications for break(unknown); default 399

trim(#) end trimming fraction for the break search; default 0.15

seed(#) random-number seed for the bootstrap

The data must be xtset. The panel must be balanced (units with any
missing time period are dropped).

Description

xtgunitroot implements the generalized fixed-T panel unit root test of
Karavias and Tzavalis (2019), based on the doubly
modified estimator (DME). Unlike the simpler fixed-T tests, the DME is robust to

- short-term serial correlation of unspecified form (up to order maxlag),

- heteroscedasticity and error cross-section heterogeneity,

- a common structural break at a known or unknown date,

while remaining valid for a large number of cross-section units N and a
small, fixed number of time periods T, and invariant to the initial condition.

The model is y(i,t) = X(i,t)'pi(i) + zeta(i,t), zeta(i,t) = phi*zeta(i,t-1) +
u(i,t), where u may be serially correlated and heteroscedastic. The test is

H0: phi = 1 (unit root) vs H1: phi < 1 (stationary).

The within-groups estimator of phi is inconsistent for fixed T; the DME
applies two bias corrections (a numerator correction and a nonparametric
covariance correction in the spirit of Abowd-Card and Arellano), giving a
statistic that is asymptotically standard normal under H0 (known break) and is
rejected for small (negative) values.

xtgunitroot complements xtmunitroot (which handles missing
values under an i.i.d.-error assumption): use xtgunitroot when the
errors are serially correlated or heteroscedastic and the panel is (made)
balanced; use xtmunitroot when the panel has gaps.

Scope of this version. Only the intercept and break (individual
intercepts, with or without a common break) specifications are available.
Incidental-trend specifications require the trend-nuisance covariance
machinery and are not yet included; note that fixed-T panel unit root tests have
trivial local power against incidental trends
(Moon, Perron and Phillips 2007).

Options

model(spec) sets the deterministic component: intercept
(individual intercepts, default) or break (individual intercepts with a
common structural break). Abbreviations i, b.

break(#) is required for break. A value in (0,1) is a break
fraction; any other number is a calendar date; unknown searches
all admissible break dates (the inf-t statistic) and obtains the p-value by
bootstrap.

maxlag(p) is the maximum order of serial correlation the test is
made robust to (the pmax-dependence bound). With maxlag(0) the errors are
treated as serially uncorrelated. For MA(q)-type dependence set maxlag(q).
Choosing p larger than the true order is conservative (safe); too small can
distort size.

breps(#), trim(#), seed(#) control the unknown-break
bootstrap: number of replications, the fraction trimmed from each end of the
break-date search, and the RNG seed for reproducibility.

Stored results

xtgunitroot stores the following in r():

Scalars

r(phi) within-groups estimate of phi

r(phi_dme) doubly modified (bias-corrected) estimate of phi

r(bias) bias correction b/d

r(z) test statistic (inf-t under break(unknown))

r(p) p-value (bootstrap under break(unknown))

r(N) / r(N_used) / r(N_drop) panels total / used / dropped

r(T) number of equations

r(maxlag) serial-correlation order used

r(kbreak) break equation index (break models)

r(cv05) / r(reps) 5% bootstrap critical value / replications (unknown break)

Macros

r(cmd) r(depvar) r(ivar) r(tvar) r(model)

Matrices

r(profile) under break(unknown): the t(date) profile (kindex, date, tstat)

Examples

Balanced panel with serially correlated errors:

. xtset id year

. xtgunitroot y, maxlag(1)

Structural break at a known date, robust to MA(1) errors:

. xtgunitroot y, model(break) break(2008) maxlag(1)

Structural break at an unknown date (inf-t with bootstrap p-value):

. xtgunitroot y, model(break) break(unknown) maxlag(1) breps(499) seed(42)

References

Karavias, Y., and E. Tzavalis. 2019. Generalized fixed-T panel unit root
tests. Scandinavian Journal of Statistics 46(4): 1227-1251.
doi:10.1111/sjos.12392.

Moon, H. R., B. Perron, and P. C. B. Phillips. 2007. Incidental trends
and the power of panel unit root tests. Journal of Econometrics 141: 416-459.
doi:10.1016/j.jeconom.2006.10.001.

Author

Merwan Roudane

merwanroudane920@gmail.com

github.com/merwanroudane