*! version 1.0.0 11jul2026

Title

xthpool -- Hausman poolability test for cointegrated panels
(Westerlund and Hess 2011)

Syntax

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

Model
factors(#) fix the number of common factors r; default is
selection by the Bai-Ng IC1 criterion

rmax(#) maximum number of factors searched by IC1; default
rmax(5)

defactor(varlist) observable common factors g_t driving the
regressors; the test uses the defactored regressors

bandwidth(#) Newey-West Bartlett bandwidth M; default is the
Newey-West rule floor(4*(T/100)^(2/9))

Test
aconst(#) Gumbel scale constant a_N; default aconst(2)

iterate run the iterative (sequential-drop) poolability scheme

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

Graph
graph plot the individual Hausman statistics against the rejection
threshold

name(str) name for the graph

The panel must be xtset, balanced and have no gaps.
depvar and indepvars are the levels of the cointegrating regression;
they are assumed to be I(1) and cointegrated.

Description

xthpool implements the poolability test of Westerlund and Hess (2011,
Journal of Applied Econometrics). Consider the cointegrated panel

y_it = a_i + b_i x_it + e_it,

where b_i is a unit-specific slope vector and the error e_it may
contain r common factors, so the cross-sectional units are dependent. The
test evaluates the null hypothesis of poolability

H0: b_i = b for all i

against the heterogeneous alternative that at least one unit differs. It
compares an individual and a pooled bias-adjusted least-squares
estimator of the cointegrating slope, unit by unit, in a Hausman (1978) way, and
takes the maximum of the individual Hausman statistics. After a Gumbel
normalization the statistic has a well-defined limiting distribution even when
N is of the same order as T — a regime where the seemingly-unrelated
Wald test of Mark, Ogaki and Sul (2005) is badly distorted.

Cross-sectional dependence in the error is handled by estimating the common
factors with principal components (Bai and Ng 2002, 2004). When the regressors
are themselves driven by observable common factors g_t, option
defactor() projects them out first (Corollary 1 of the paper).

See help xthpool methods for the estimator, the
step-by-step mapping to the paper's equations, and the derivation.

Options

Model

factors(#) fixes the number of common factors r in the error at
#. With factors(0) no factors are removed (independent units). By
default r is estimated by the Bai-Ng IC1 information criterion over
0..rmax.

rmax(#) sets the largest number of factors considered by IC1. Default
is rmax(5), as in the paper.

defactor(varlist) lists the observable common factors g_t that
also drive the regressors. Each regressor is projected on g_t unit by unit
and the projection residual (the "defactored" regressor) is used in the test.
g_t must be stationary; test it for unit roots first (see Remarks).

bandwidth(#) sets the Bartlett-kernel bandwidth M used for the
Newey-West long-run (co)variances. The default is the Newey-West rule
floor(4*(T/100)^(2/9)). Larger M guards against stronger serial
correlation at the cost of more noise.

Test

aconst(#) is the Gumbel scale constant a_N. The paper shows
aconst(2) works well even for small N and it is the default.

iterate applies the test sequentially: the maximizing unit is dropped
after a rejection and the test is recomputed, until two units remain. The
reported adjusted p-value keeps the overall significance level across steps (the
step-j critical value is the upper alpha^j Gumbel percentile).

level(#) sets the confidence level; default level(95).

Graph

graph draws the sorted individual Hausman statistics with the 5% rejection
threshold overlaid. name(str) names the graph.

Remarks

Sample size. Theorem 1 requires sqrt(N)/T -> 0, i.e. T large
relative to N (in practice T^2 > N). The test is designed for exactly
the N ~ T regime that defeats SUR-Wald tests, but very small T
(below ~50) can leave the maximum statistic mildly liberal; prefer T of 100
or more when available.

Cointegration is assumed. xthpool conditions on the regression being
cointegrated. Test that first (e.g. xtcointtest or Westerlund's tests);
poolability is not meaningful for a spurious regression.

Defactoring. Use defactor() when the regressors share observable
common shocks (e.g. a monetary model where relative money and output both
contain the U.S. aggregates). The factors in g_t must be distinct from
those in the error and must be stationary; otherwise the limiting
distribution is contaminated. If the common factors are unknown, estimate them
from the first-differenced regressors (Bai and Ng 2004) and pass the accumulated
projection residuals.

This is a test against a single violation. Because it uses the maximum, the
test has power against even one non-poolable unit. The iterate scheme
identifies which units are not poolable, but its power falls at each step as
the corrected critical value grows.

Interpreting the output

H_max is the largest individual Hausman statistic across units.
Z_max is its Gumbel normalization (H_max - b_N)/a_N with
b_N = invchi2(m, 1-1/N) and m the number of regressors. The
Gumbel p-value is 1 - exp(-exp(-Z_max)): a small value rejects
poolability. The line "Most extreme unit" names the unit attaining the
maximum — the prime candidate for being non-poolable. Under iterate, "p (raw)"
is the one-step Gumbel p-value at that step and "p (adj)" is corrected to
maintain the overall level across the sequential drops.

Examples

Setup

. webuse grunfeld

. xtset company year

Test whether the investment slopes are poolable

. xthpool invest mvalue kstock

Fix one common factor and draw the diagnostic plot

. xthpool invest mvalue kstock, factors(1) graph

Sequentially identify the non-poolable units

. xthpool invest mvalue kstock, iterate

Regressors driven by an observable common factor g

. xthpool y x, defactor(g)

A complete, self-contained demonstration with a simulated data-generating
process (size and power) ships as xthpool_example.do.

Stored results

xthpool stores the following in r():

Scalars

r(Hmax) maximum Hausman statistic

r(Zmax) Gumbel-normalized statistic

r(p) Gumbel p-value

r(N) number of units

r(T) time-series length

r(m) number of regressors

r(r) number of common factors used

r(bw) Newey-West bandwidth

r(aN) Gumbel scale constant

r(imax) id of the maximizing (most extreme) unit

Macros

r(cmd) xthpool

r(depvar) dependent variable

r(indepvars) regressors

r(ivar) panel variable

r(tvar) time variable

Matrices

r(Hi) individual Hausman statistics

r(unit) corresponding unit ids

r(bplus) unit ids and bias-adjusted individual slopes

r(itertable) iteration table (with iterate)

References

Bai, J., and S. Ng. 2002. Determining the number of factors in approximate
factor models. Econometrica 70: 191-221.

Bai, J., and S. Ng. 2004. A PANIC attack on unit roots and cointegration.
Econometrica 72: 1127-1177.

Hausman, J. 1978. Specification tests in econometrics.
Econometrica 46: 1251-1271.

Newey, W. K., and K. D. West. 1994. Automatic lag selection in covariance matrix
estimation. Review of Economic Studies 61: 631-653.

Westerlund, J., and W. Hess. 2011. A new poolability test for cointegrated
panels. Journal of Applied Econometrics 26: 56-88.
doi:10.1002/jae.1143.

Author

Dr Merwan Roudane

merwanroudane920@gmail.com

github.com/merwanroudane