*! version 1.0.1 04feb2026

Title

hatemicoint -- Tests for cointegration with two unknown regime shifts

Syntax

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

Main
maxlags(#) maximum number of lags for ADF test; default is maxlags(8)

lagselection(string) lag selection criterion: aic, sic, or tstat; default is tstat

kernel(string) kernel for long-run variance: iid, bartlett, or qs; default is iid

bwl(#) bandwidth for long-run variance; default is round(4*(T/100)^(2/9))

trimming(#) trimming rate for break search; default is trimming(0.15)

model(#) model specification; only model(3) (regime shift) is supported

You must tsset your data before using hatemicoint; see tsset.

depvar and indepvars may contain time-series operators; see tsvarlist.

Description

hatemicoint implements three residual-based tests for cointegration in the presence of two unknown regime shifts,
as developed by Hatemi-J (2008). The tests allow for structural breaks in both the intercept and slope parameters
at two unknown points in the sample. The timing of the breaks is determined endogenously by searching over all
possible break combinations within a trimmed range.

The command tests the null hypothesis of no cointegration against the alternative of cointegration with two regime shifts.
It reports three test statistics:

ADF*: Augmented Dickey-Fuller test on residuals with two regime shifts

Zt*: Phillips-Perron Zt test on residuals with two regime shifts

Za*: Phillips-Perron Za (Zalpha) test on residuals with two regime shifts

All three tests search for the break points that provide the strongest evidence against the null hypothesis
(i.e., the most negative test statistics). The critical values are based on response surface analysis
and Monte Carlo simulations as reported in Hatemi-J (2008).

The model estimated is:

yt = α0 + α1D1t + α2D2t + β'0xt + β'1D1txt + β'2D2txt + ut

where D1t and D2t are dummy variables that equal 1 after the first and second break points, respectively.

Options

Main

maxlags(#) specifies the maximum number of lags to consider in the ADF test regression.
The default is 8. A higher value allows for more flexible dynamics but may reduce power in small samples.

lagselection(string) specifies the criterion for selecting the optimal number of lags in the ADF test.
Options are:

aic - Akaike Information Criterion

sic - Schwarz Information Criterion (also known as BIC)

tstat - t-statistic significance approach (default). This method starts with maxlags and
sequentially tests whether the coefficient on the last lag is significant, reducing the lag order
until a significant coefficient is found or zero lags is reached.

kernel(string) specifies the kernel function for computing the long-run variance in the Phillips-Perron tests.
Options are:

iid - No long-run variance correction (assumes i.i.d. errors; default)

bartlett - Bartlett kernel

qs (or quadraticspectral) - Quadratic spectral kernel

bwl(#) specifies the bandwidth for the long-run variance estimation.
The default is round(4*(T/100)^(2/9)) following Andrews (1991).
This option is only used when kernel is bartlett or qs.

trimming(#) specifies the trimming proportion for the break search.
The default is 0.15, meaning that breaks are searched for in the range [0.15T, 0.85T]
and the two breaks must be at least 0.15T observations apart. This follows the approach
of Gregory and Hansen (1996). The value must be between 0 and 0.5.

model(#) specifies the model type. Currently only model(3) is supported,
which allows for regime shifts in both the intercept and slope parameters (the default and only option).

Remarks

hatemicoint extends the Gregory and Hansen (1996) cointegration test to allow for two regime shifts
instead of one. The test is appropriate when:

1. You suspect two structural breaks in the cointegrating relationship.

2. The timing of the breaks is unknown a priori.

3. You want to test for cointegration while accounting for these breaks.

The test works by:

1. Estimating the cointegrating regression for all possible combinations of two break points
(subject to the trimming constraint).

2. Computing the test statistic for each combination.

3. Selecting the minimum (most negative) test statistic as the test value.

4. Comparing this value to critical values that account for the search process.

Critical values are available for models with 1 to 4 independent variables (k = 1, 2, 3, 4).
These values were generated via simulation methods and are reported at the 1%, 5%, and 10% significance levels.
For k > 4, the command will produce an error as critical values are not available.

Interpretation: The null hypothesis is no cointegration. More negative values of the test statistics
provide stronger evidence against the null. If the test statistic is more negative than the critical value,
reject the null and conclude there is cointegration with regime shifts.

Computational note: The command searches over all valid break combinations, which can be computationally
intensive for large datasets. With default trimming of 0.15, approximately (0.55T)*(0.7T)/2 regressions
are estimated, which could be substantial for large T.

Panel data: This test is designed for single time series only. Panel data is not supported.
If you have panel data, use xtset and analyze each panel separately or use
panel cointegration tests such as xtcointtest.

Sample size: The test requires a reasonably large sample size. With default trimming of 0.15,
you need at least T > 20 observations to have valid break search regions. Larger samples provide
more reliable inference.

Examples

Setup

. webuse lutkepohl2

. tsset qtr

Basic test with default options

. hatemicoint ln_inv ln_inc

Specify maximum lags and use AIC for lag selection

. hatemicoint ln_inv ln_inc, maxlags(12) lagselection(aic)

Use quadratic spectral kernel and custom bandwidth

. hatemicoint ln_inv ln_inc, kernel(qs) bwl(8)

Use more conservative trimming

. hatemicoint ln_inv ln_inc, trimming(0.20)

Test with multiple regressors

. hatemicoint ln_inv ln_inc ln_consump

Access stored results

. hatemicoint ln_inv ln_inc

. return list

. display "ADF test statistic: " r(adf_min)

. display "First break at observation: " r(tb1_adf)

Stored results

hatemicoint stores the following in r():

Scalars

r(adf_min) minimum ADF test statistic

r(tb1_adf) first break location for ADF test (observation number)

r(tb2_adf) second break location for ADF test (observation number)

r(zt_min) minimum Zt test statistic

r(tb1_zt) first break location for Zt test (observation number)

r(tb2_zt) second break location for Zt test (observation number)

r(za_min) minimum Za test statistic

r(tb1_za) first break location for Za test (observation number)

r(tb2_za) second break location for Za test (observation number)

r(nobs) number of observations

r(k) number of independent variables

Matrices

r(cv_adfzt) 1x3 matrix of critical values for ADF and Zt tests (1%, 5%, 10%)

r(cv_za) 1x3 matrix of critical values for Za test (1%, 5%, 10%)

References

Andrews, D. W. K. 1991. Heteroskedasticity and autocorrelation consistent covariance matrix estimation.
Econometrica 59: 817-858.

Engle, R. F., and C. W. J. Granger. 1987. Cointegration and error correction: Representation,
estimation and testing. Econometrica 55: 251-276.

Gregory, A. W., and B. E. Hansen. 1996. Residual-based tests for cointegration in models with regime shifts.
Journal of Econometrics 70: 99-126.

Hatemi-J, A. 2008. Tests for cointegration with two unknown regime shifts with an application
to financial market integration. Empirical Economics 35: 497-505.

Phillips, P. C. B. 1987. Time series regression with a unit root.
Econometrica 55: 277-301.

Author

Dr. Merwan ROUDANE

Independent Researcher

Email: merwanroudane920@gmail.com

Also see

Online: dfuller, pperron, vecrank, xtcointtest