*! version 1.0.0 11jul2026

Title

xthpool methods -- Methodology and derivation of the Hausman
poolability test (Westerlund and Hess 2011)

The model and hypotheses

The cointegrated panel data-generating process is (eqs 1-3 of the paper)

y_it = a_i + b_i x_it + e_it,

x_it = x_i,t-1 + v_it,

e_it = lambda_i' f_t + u_it,

where x_it is an m-vector of I(1) regressors, f_t is a vector of
r unobserved common factors with loadings lambda_i, and u_it is an
idiosyncratic I(0) error. The common factors make the units cross-sectionally
dependent. The hypotheses are

H0: b_i = b for all i vs H1: b_i != b for
some i.

Individual and pooled estimators

Let x°_it = x_it - mean_t(x_it) be the within (fixed-effects)
transformed regressor and M_i = sum_t x°_it x°_it'. The individual
and pooled least-squares slopes are

b_i^ = [sum_t y_it x°_it'] M_i^-1,

b_pool^ = [sum_i sum_t y_it x°_it'] M_pool^-1,
M_pool = sum_i M_i.

Bias adjustment

Because the regressors are endogenous and the error carries common factors, the
least-squares slopes are biased. Define z_it = (f_t', u_it,
v_it')' and let Delta = Omega + Lambda + Lambda' be the
Newey-West Bartlett long-run covariance of z_it, with Omega the
contemporaneous term and Lambda = sum_ the one-sided lagged sum. Write
Gamma = Omega + Lambda = Delta - Lambda' for the
one-sided long-run covariance. The bias corrections are

U_fvi = Delta_fv Delta_vv^-1 (sum_t dx_it x°_it' - T
Gamma_vv) + T Gamma_fv,

U_uvi = Delta_uv Delta_vv^-1 (sum_t dx_it x°_it' - T
Gamma_vv) + T Gamma_uv,

U_i = lambda_i' U_fvi + U_uvi,

and the bias-adjusted slopes are b_i+ = b_i^ - U_i M_i^-1 and
b_pool+ = b_pool^ - (sum_i U_i) M_pool^-1. The one-sided
Gamma (contemporaneous plus lagged, not the lagged sum alone) is what
makes the correction remove the drift exactly: on p.79 of the paper
(1/T) sum_t dx_it x°_it' - Gamma_vv
converges to a driftless stochastic integral.

The Hausman statistic

The individual Hausman statistic contrasts each unit's bias-adjusted slope with
the pooled one, weighted by the (realized) information and the conditional
long-run variance of the error,

Delta_e.vi = lambda_i'(Delta_ff - Delta_fv
Delta_vv^-1 Delta_vf) lambda_i + (Delta_uu - Delta_uv
Delta_vv^-1 Delta_vu),

H_i = (b_i+ - b_pool+) M_i (b_i+ - b_pool+)' /
Delta_e.vi.

A note on the variance. The paper writes the asymptotic variance of
T(b_i+ - b) as M^-1 (1/6 Delta_e.v Delta_vv) M^-1. The
factor 1/6 Delta_vv is the probability limit of the
normalized moment matrix M_i/T^2 (because E[integral of a demeaned
Brownian bridge squared] = 1/6), used only to state the variance in closed form.
Plugging that expression literally with the realized M_i would give a
statistic equal to chi-square times a random multiple of the realized
6 M_i/T^2/Delta_vv and would not be pivotal.
Theorem 1 (and Remark 2, invoking the maximum domain of attraction of the Gumbel
for chi-square/Gamma variates) requires each H_i to be asymptotically
chi-square(m); this is obtained by using the realized information
M_i as above. That is the form xthpool computes.

The test statistic is the maximum and its Gumbel normalization,

H_max = max_i H_i, Z_max = (H_max - b_N)/a_N,

b_N = F^-1(1 - 1/N), a_N = 2,

where F is the chi-square(m) cdf. Under H0 and Assumptions 1-5, as
N,T -> infinity with sqrt(N)/T -> 0,

P(Z_max <= x) -> exp(-exp(-x)) (Gumbel),

so the p-value is 1 - exp(-exp(-Z_max)).

Estimating the common factors

The factors are estimated by principal components from the individual
least-squares residuals e^_it = y°_it - b_i^ x°_it. Stacking
these into the T x N matrix e^, f^ is sqrt(T) times the
eigenvectors of the r largest eigenvalues of e^ e^', the loadings are
lambda^ = (1/T) f^' e^, and u^_it = e^_it -
lambda^_i' f^_t. The number of factors is chosen by the Bai-Ng IC1
criterion

IC1(r) = log(V(r)) + r [(N+T)/(NT)]
log(NT/(N+T)), V(r) = (1/NT) sum_i sum_t
u^_it^2,

minimized over 0..rmax. Set factors(#) to fix r.

Defactoring the regressors (Corollary 1)

If the regressors follow x_it = Gamma_i g_t + w_it with
w_it a random walk and g_t observable stationary common factors, the
poolability test is applied to the defactored regressor x_it^p =
x_it - Gamma^_i g_t, where Gamma^_i is the unit-by-unit
least-squares projection of x_it on g_t. Corollary 1 shows the Gumbel
result carries over. g_t must be distinct from the error factors and
stationary.

Iterative poolability (Section 3.2)

To learn which units are poolable, the maximizing unit is removed after a
rejection and the test recomputed. Because step j is only reached after
j-1 previous rejections, the correct critical value at step j is the
upper alpha^j percentile of the Gumbel distribution; equivalently the
reported adjusted p-value is the one-step p-value raised to the power
1/j. xthpool, iterate tabulates the dropped unit, H_max, Z_max and
both p-values at every step.

Step-to-equation map

Each block of xthpool.ado is tagged [A]-[J] against the paper:

[A] within demeaning of y_it, x_it — eqs (1),(6)

[B] individual and pooled LS slopes — Section 2.2

[C] principal-components factors f^,lambda^,u^ — Section
2.2, p.63

[D] IC1 factor-number selection — Proposition 1

[E] Newey-West Bartlett long-run covariance of z_it — Section 2.2

[F] one-sided bias terms and b_i+, b_pool+ — pp.60-61,
Appendix p.79

[G] individual Hausman statistic H_i — p.61, Lemma A.1

[H] H_max, Z_max, Gumbel p-value — Theorem 1, Remarks 1-3

[I] defactoring on observable g_t — Corollary 1, eqs (4),(5)

[J] iterative sequential-drop scheme — Section 3.2

Author

Dr Merwan Roudane

merwanroudane920@gmail.com

github.com/merwanroudane