*! version 1.0.0 10feb2026

Title

xtdhcoint -- Durbin-Hausman panel cointegration tests

Syntax

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

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

criterion(string) information criterion for factor selection:
ic, pc, aic, or bic; default is ic

penalty(#) penalty type (1, 2, or 3); default is 1

predet(#) use predetermined cointegrating coefficient

noconstant suppress constant term in regression

Inference
bandwidth(#) kernel bandwidth for HAC estimation;
default is Newey-West automatic

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

Reporting
notable suppress output table

A panel variable and a time variable must be specified using xtset.

Description

xtdhcoint implements the Durbin-Hausman panel cointegration tests
proposed by Westerlund (2008). These tests are designed to test the null
hypothesis of no cointegration against the alternative of cointegration in
panel data settings.

The tests have several important advantages over existing panel cointegration
tests:

1. They allow for cross-sectional dependence through common factors.

2. They are robust to stationary regressors.

3. They can accommodate predetermined cointegrating vectors.

4. Their asymptotic distributions are standard normal.

Two test statistics are computed:

DHg (group mean test): Tests H0: phi_i = 1 for all i versus
H1: phi_i < 1 for some i. A rejection suggests cointegration for at
least some cross-sectional units.

DHp (panel test): Tests H0: phi_i = 1 for all i versus
H1: phi_i = phi < 1 for all i. A rejection suggests cointegration for
all cross-sectional units with a common autoregressive parameter.

Options

Model

kmax(#) specifies the maximum number of common factors to consider
when selecting the optimal number using information criteria. The default
is 5. The actual number of factors used is selected by minimizing the
specified information criterion.

criterion(string) specifies the information criterion used to
determine the number of common factors:

ic uses the IC_p1 criterion of Bai and Ng (2002). This is the default.

pc uses the PC_p1 criterion of Bai and Ng (2002).

aic uses the Akaike Information Criterion.

bic uses the Bayesian Information Criterion.

penalty(#) specifies the penalty function type (1, 2, or 3) as
described in Bai and Ng (2002). The default is 1.

predet(#) specifies a predetermined value for the cointegrating
coefficient. When specified, the test uses this value instead of
estimating the coefficient from the data. This is useful for testing
specific theoretical restrictions, such as the unit coefficient in
the Fisher effect. Default is 0 (estimate the coefficient).

noconstant suppresses the constant term in the cointegrating regression.

Inference

bandwidth(#) specifies the bandwidth for the Bartlett kernel
used in heteroskedasticity and autocorrelation consistent (HAC) variance
estimation. The default is the Newey-West automatic bandwidth:
floor(4*(T/100)^(2/9)).

level(#) sets the confidence level for determining whether to reject
the null hypothesis. The default is 95.

Reporting

notable suppresses the display of the results table.

Remarks

The Durbin-Hausman tests are based on comparing two estimators of the
autoregressive parameter in the recumulated defactored residuals. Under
the null hypothesis of no cointegration, both the OLS and IV estimators
converge to unity. Under the alternative of cointegration, the OLS
estimator remains consistent while the IV estimator does not, leading
to a divergence that forms the basis of the test.

The test procedure involves the following steps:

1. Estimate the cointegrating regression in first differences.

2. Extract common factors from the residuals using principal components.

3. Defactor the residuals.

4. Recumulate the defactored residuals.

5. Compute the Durbin-Hausman statistics using OLS and IV estimators.

6. Standardize using the asymptotic moments from Westerlund (2008).

The simulated moments (100,000 replications, T=1000) are:

E(B_i) = 5.5464, Var(B_i) = 36.7673

E(C_i) = 0.5005, Var(C_i) = 0.3348

Both standardized statistics diverge to positive infinity under the
alternative hypothesis, so the computed value should be compared to the
right tail of the normal distribution.

Interpreting the output

The output table shows:

Avg.Stat: The average per-unit statistic (raw sum divided by N). This
is comparable across different sample sizes.

E(.) H0: The theoretical mean of the average statistic under the null
hypothesis of no cointegration. For DHg, E(B_i) = 5.5464. For DHp,
1/E(C_i) = 1/0.5005 = 1.998.

Z-value: The standardized test statistic: Z = sqrt(N) * (Avg.Stat - E(.)) / se.
If Avg.Stat is close to E(.) H0, the z-value is near zero and there is no
evidence against H0. If Avg.Stat is much larger than E(.) H0, the z-value
is large and positive, indicating cointegration.

P-value: Right-tail probability from the standard normal distribution.

Important: Compare Avg.Stat to E(.) H0 to understand the result.
If Avg.Stat ~ E(.) H0, the test fails to reject (no cointegration).
If Avg.Stat >> E(.) H0, the test rejects (evidence of cointegration).

Note on multiple regressors: The simulated moments are valid for K=1
(one regressor). With multiple regressors, run separate bivariate tests.

Examples

Setup

. webuse grunfeld, clear

. xtset company year

Basic test for cointegration

. xtdhcoint invest mvalue kstock

Test with predetermined coefficient (e.g., testing Fisher effect with unit slope)

. xtdhcoint invest mvalue, predet(1)

Specify maximum factors and criterion

. xtdhcoint invest mvalue, kmax(3) criterion(bic)

Access stored results

. xtdhcoint invest mvalue kstock

. display "DHg z-value: " r(dhg_z)

. display "DHp p-value: " r(dhp_p)

Stored results

xtdhcoint stores the following in r():

Scalars

r(N) number of cross-sectional units

r(T) number of time periods

r(K) number of regressors

r(nf) estimated number of common factors

r(bandwidth) kernel bandwidth used

r(kmax) maximum factors considered

r(dhg) DHg raw statistic

r(dhp) DHp raw statistic

r(dhg_z) DHg standardized z-value

r(dhp_z) DHp standardized z-value

r(dhg_p) DHg asymptotic p-value

r(dhp_p) DHp asymptotic p-value

Macros

r(depvar) dependent variable name

r(indepvars) independent variable names

r(criterion) information criterion used

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.

Pedroni, P. 2004. Panel cointegration: Asymptotic and finite sample
properties of pooled time series tests with an application to the PPP
hypothesis. Econometric Theory 3: 579-625.

Westerlund, J. 2008. Panel cointegration tests of the Fisher effect.
Journal of Applied Econometrics 23: 193-233.
https://doi.org/10.1002/jae.967

Author

Dr. Merwan Roudane

Independent Researcher

merwanroudane920@gmail.com

Based on the original GAUSS code by Joakim Westerlund (Lund University).

Also see

Help: xtunitroot, xtcointtest, dfgls