help xtbreak xtbreak v. 1.1 - 10. January 2022

Title

xtbreak - estimating and testing for many known and unknown structural breaks in time series and panel data.

Syntax

For a more detailed description for testing see xtbreak test and on estimation see xtbreak estimate.

Automatic estimation of number and location of break:

xtbreak depvar [indepvars] [if] [in] ,
options1
options2
options5

Testing for known structural breaks:

xtbreak test depvar [indepvars] [if] [in] ,
breakpoints(numlist| datelist [,index|fmt(format)])
options1
options5

breakpoints(numlist[,index|fmt()]) specifies the time period of the known
structural break.

Testing for unknown structural breaks:

xtbreak test depvar [indepvars] [if] [in] ,
hypothesis(1|2|3)
breaks(#)
options1
options2
options3
options4
options5

hypothesis(1|2|3) specifies which hypothesis to test, see hypothesises.
breaks(#) sets the number of breaks.

Estimation of breakpoints:

xtbreak estimate depvar [indepvars] [if] [in] ,
breaks(#)
showindex
options1
options2
options5

breaks(#) sets the number of breaks.

Maintenance

xtbreak , [update version]

version displays version.
update updates xtbreak from GitHub
using net install.

Contents

Description

Options

Panel Data

Covariance Estimator

Examples

Refrences

Authors and About

Description

xtbreak test implements multiple tests for structural breaks in time series and panel data models.
The number and period of occurrence of structural breaks can be known and unknown.
In the case of a known breakpoint xtbreak test can test if the break occurs at a specific point in time.
For unknown breaks, xtbreak test implements three different hypothesises.
The first is no break against the alternative of s breaks,
the second hypothesis is no breaks against a lower and upper limit of breaks.
The last hypothesis tests the null of s breaks against the alternative of
one more break (s+1).
For a further explanation see xtbreak test.

xtbreak estimate estimates the location of the break points.
The underlying idea is that if the model with the true breakdates given a number of breaks
has a smaller sum of squared residuals (SSR) than a model with
incorrect breakdates.
To find the breakdates, xtbreak estimate uses the algorithm (dynamic program) from Bai and Perron (2003).
All necessary SSRs are calculated and then the smallest one selected.
For a further explanation see xtbreak estimate.

xtbreak implements the tests for and estimation of structural breaks discussed in
Bai & Perron (1998, 2003),
Karavias, Narayan, Westerlund (2021)
and Ditzen, Karavias, Westerlund (2021).

If neither test or estimate is defined,
xtbreak will do a sequential F-Test based on hypothesis 3 to determine the
number of breaks.
It will then select the number of breaks as the maximum number the hypothesis is rejected
using the the critical value as set by c(level).
Then it will estimate the breakdates using xtbreak estimate.

Options

breakpoints(numlist ,index |
datelist, fmt(fmt))
specifies the known
breakpoints.
Kown breakpoints can be set by either the number of observation or by the value of the
time identifier.
If a numlist is used, option index is required.
For example breakpoints(10,index) specifies that the one break occurs at the 10th observation in time.
datelist takes a list of dates.
For example breakpoints(2010Q1,fmt(tq)) specifies a break in Quarter 1 in 2010.
If a datelist is used,
the format set in breakpoints() and the time identifier needs to be the same.

wdmax Use weighted test statistic instead of
unweighted for the double maximum test (hypothesis 2).

level(#) set level for critical values for weighted double maximum test.
If a value is chosen for which no critical values exists, xtbreak test will choose the closest level.

hypothesis(1|2|3) specifies which hypothesis to test, see xtbreak test - unknown break dates.

h(1) test for no breaks vs. s breaks,

h(2) for no break vs. s0 <= s <= s1 breaks and

h(3) for s vs. s+1 breaks.

showindex shows index for confidence intervals rather than formatted time value.

update Update xtbreak from Github.
This is essentially the following call:

//janditzen.github.io/xtbreak/") force replace"'

version Displays version.

Examples

Time Series

This example was presented in similar form at the Stata Conference 2021.
We will try to estimate the breakpoints in the relationship
between COVID infections in the US and deaths from the virus in 2020 and 2021.
Weekly data is available on GitHub.
The variable deaths are deaths from COVID and the variable cases contains
the number of new covid cases.
The idea is that initially more people died from COVID because it was a new virus.
Then medical treatment advanced and vaccines became more available which should
decrease deaths.
On the other hand COVID cases have likely been under-reported during the first wave.
We assume that there is a lag between the a positive test and death of one week.
The data is from the CDC.

First we load the data into Stata:

use https://github.com/JanDitzen/xtbreak/raw/main/data/US.dta

We start with no prior knowledge of i) the number of breaks and ii) the exact date of each break.
Therefore before estimating the breakpoints we use the sequential F-Test based on hypothesis 2 (details):

xtbreak deaths L1.cases

We find three breaks, the first in week 20 in 2020, the second at the end of 2020
and the last in week 11 in 2021.
However, we note that the second break has very wide confidence intervals.
This can be caused by the break being very small.
We thus proceed with only 2 breaks.

We estimate the model with just two breaks:

xtbreak estimate deaths L1.cases, breaks(2)

We find the same breakpoints and the confidence intervals are small.

Next we test the hypothesis of no breaks against 2 breaks using hypothesis 1
(see details):

xtbreak test deaths L1.cases, hypothesis(1) breaks(2)

The test statistic is close to the one for the test of an additional break,
however the critical values are smaller placing a lower
bound on the rejection of the hypothesis.

Since we have an estimate of the breakpoints, we can test the two breakpoints
as known breakpoints (see details):

xtbreak test deaths L1.cases, breakpoints(2020w20 2021w11 , fmt(tw))

Since we are using a datelist, we need to specify the format of it.
datelist also has to be the same format as the time identifier.

We have established that we have found 2 breaks. We can test the hypothesis 3, i.e. 2 breaks against the alternative of 3 breaks
(see details):

xtbreak test deaths L1.cases, hypothesis(3) breaks(3)

First, note that we have to define in breaks() the alternative, that is we use breaks(3).
Secondly we are able to reject the hypothesis of 2 breaks.
However as discussed before, the thrid break is estimated unprecisly.
Panel data can contribute additional information for a better estimate
as discussed in the next section.

So far we have assumed no break in the constant, only in the number of COVID cases.
We can test for only a break in the constant and keep the coefficient of the cases fixed.
To do so, the options nobreakvar(L.cases) and breakconstant are required.

xtbreak test deaths , breakconstant nobreakvar(L1.cases) breaks(3)

After testing for breaks thoroughly we can estimate the breaks and construct confidence intervals (see details):

xtbreak estimate deaths L1.cases, breaks(2)

If we want to see the index of the confidence interval rather than the date, the option showindex can be used:

xtbreak estimate deaths L1.cases, breaks(2) showindex

We can split the variable L1.cases into the different values for each regime using estat split.
The variable list is saved in r(varlist) and we run a simple OLS regression on it:

estat split
reg deaths `r(varlist)'

Finally, we can draw a scatter plot of the variables with a different colour for each segement.
The command line is estat scatter varlist where varlist is the independent variable (X),
the dependent variable is automatically added on the y-axis.

xtbreak estimate deaths L1.cases, breaks(2) showindex
estat scatter L.cases

An example how to draw a time series line plot with confidence intervals can be found on GitHub.

Panel Data

We are using a dataset with the same variables as above, but on US State level.
First we load the dataset:

use https://github.com/JanDitzen/xtbreak/blob/main/data/US_panel.dta

As before, we start with the sequential F-Test and the estimation of the break dates.
We account for heteroskedasticity and autocorrelation by using an HAC robust variance estimator with the option vce(hac).
Otherwise the syntax remains the same.
xtbreak automatically detects if a panel or time series is used.

xtbreak deaths L.cases, vce(hac)

We find evidence for 2 and 4 breaks.
As this is a panel data set, we account for cross-section dependence as well using csa(L.cases) and
we set the trimming to 10% with trimming(0.1):

xtbreak deaths L.cases, vce(hac) csa(L.cases) trimming(0.1)

Using this we observe that the values of the test stastic across all F-Statistics are relatively low.
We are never able to reject the hypothesis of no break at a level of 1\%.
Using a level of 5\%, we are able to reject F(1|0) and F(3|2), which implies either no break or 2 breaks. We test the null of no breaks against up to 5 breaks:

xtbreak test deaths L.cases, h(2) breaks(5) trimming(0.1) vce(hac) csa(L.cases)

We find evidence for breaks, thus we are going to test the alternatives of one and three breaks:

xtbreak test deaths L.cases, h(1) breaks(1) trimming(0.1) vce(hac) csa(L.cases)

xtbreak test deaths L.cases, h(1) breaks(3) trimming(0.1) vce(hac) csa(L.cases)

Given that we are just about to reject the null hypothesis in the case of 1 break,
we will assume 3 breaks.
Next we are going to estimate the break points and run a fixed effects regression:

xtbreak estimate deaths L.cases, breaks(3) trimming(0.1) vce(hac) csa(L.cases)

estat split L.cases

xtreg deaths `r(varlist)', fe