```help ghansen
-------------------------------------------------------------------------------

Title

ghansen -- Gregory-Hansen test for cointegration with regime shifts

Syntax

ghansen depvar indepvars [if] [in] , break(string) lagmethod(string)
[maxlags(integer) trim(real) level(real)]

options               Description
-------------------------------------------------------------------------
Main
break                type of structural break of cointegration vector
lagmethod            Method for lag selection in adf test
maxlags              Maximum lags to search in adf test
trim                 fraction of data range to skip at either end when
examining possible break points
level                confidence level for downward t statistic lag
-------------------------------------------------------------------------
by is allowed; see [D] by.
You must tsset your data before using ghansen; see [TS] tsset.
depvar and indepvars may contain time-series operators; see tsvarlist.

Description

ghansen performs the Gregory-Hansen test for cointegration with regime
shifts proposed in Gregory and Hansen (1996) on a dependent variable
depvar and up to four independent variables in indepvars . The test's
null hypothesis is no cointegration against the alternative of
cointegration with a single shift at an unknown point in time.  ghansen
does not allow gaps within the observations of the time series.

Options

+------+
----+ Main +-------------------------------------------------------------

break(string) is required and specifies the type of break in the
cointegration vector. Details are provided in Gregory and Hansen
(1996) and Gregory and Hansen (1996a).

break(level) specifies a break in the constant term.

break(trend) specifies a break in the constant and the trend.

break(regime) specifies a break in the constant and the slope.

break(regimetrend) specifies a break in the constant, the slope and
the trend (Gregory and Hansen 1996a)

lagmethod(string) is required and specifies the algorithm to choose the
number of lags in the Augmented Dickey Fuller tests.

lagmethod(fixed) sets the number of lags equal to the maximum lags
specified in maxlag(integer)

lagmethod(aic) chooses the number of lags that minimize the Akaike
information criterion.

lagmethod(bic) chooses the number of lags that minimize the Bayesian
information criterion.

lagmethod(downt) chooses the number of lags such that the last lag is
significant according to its t-statistic, starting from a maximum
number of lags.

maxlags(integer) is optional and specifies the maximum number of lags to
include in the Augmented Dickey Fuller test, or the number of lags to
include if lagmethod is fixed. maxlags is required if lagmethod is
fixed. Default is T^0.25, where T is the sample size.

trim(real) is optional and specifies the fraction of the data range to
skip at either end when examining possible break points. Default is
0.15. trim must be a positive real number between 0 and 0.25.

level(real) is optional and specifies the cutoff confidence level for the
downt lag selection method. Default is 0.95.

Examples

. webuse balance2 ,clear

Break in level, lags chosen by Akaike criterion, maximum of 5 lags.

. ghansen y i c, break(level) lagmethod(aic) maxlags(5)

Change in regime , 5 lags chosen by user.

. ghansen y i c, break(regime) lagmethod(fixed) maxlags(5)

Change in regime and trend , downward t lag selection at the 99%
confidence level, trim 10% of sample.

. ghansen y i c, break(regimetrend) lagmethod(downt) level(0.99)
trim(0.1)

Saved results

ghansen saves the following in r():

Scalars
r(za)               za statistic
r(breakptza)        estimated breakpoint for za test
r(zt)               zt statistic
r(breakptzt)        estimated breakpoint for zt test

Macros
r(break)            Type of break
r(bzadate)          estimated break date for za test
r(bztdate)          estimated break date for zt test

Author

Jorge Pérez, Inter-American Development Bank

References

Gregory, Allan W. and Bruce E. Hansen (1996). "Residual-Based Tests for
Cointegration in Models with Regime Shifts", Journal of Econometrics
70(1), pp. 99-126.

Gregory, Allan W. and Bruce E. Hansen (1996a). "Tests for Cointegration
in Models with Regime and Trend Shifts", Oxford Bulletin of Economics and
Statistics 58 (3), pp. 555-60.

Hansen, Bruce E. (n.d.) Residual-based tests for cointegration in models
with regime shifts.  Programs -- Cointegration. Retrieved August 1, 2011
from http://www.ssc.wisc.edu/~bhansen/progs/joe_96.html

Acknowledgements

This command is based on R code provided in Hansen (n.d.) I am grateful
to Muhammad Anees and Nicholas Cox for help in identifying a bug in a
previous version of the program.

Disclaimer

This program is provided without warranty of any kind. The author is not
responsible for any cost derived by the usage of this program.

Also see

Help:  [TS] vec, [TS] vecrank, zandrews (if installed),

```