Jan Ditzen
Free University of Bozen-Bolzano
Bozen/Italy
<EMAIL_ADDRESS>and Yiannis Karavias
University of Birmingham
Birmingham/UK
<EMAIL_ADDRESS>and
Joakim Westerlund
Lund University
Lund/Sweden
<EMAIL_ADDRESS>
and
Deakin University
Melbourne/Australia
<EMAIL_ADDRESS>
# Testing and Estimating Structural Breaks in Time Series and Panel Data in
Stata

J. Ditzen  Y. Karavias and J. Westerlund

###### Abstract

Identifying structural change is a crucial step in analysis of time series and
panel data. The longer the time span, the higher the likelihood that the model
parameters have changed as a result of major disruptive events, such as the
2007–2008 financial crisis and the 2020 COVID–19 outbreak. Detecting the
existence of breaks, and dating them is therefore necessary not only for
estimation purposes but also for understanding drivers of change and their
effect on relationships. This article introduces a new community contributed
command called xtbreak, which provides researchers with a complete toolbox for
analysing multiple structural breaks in time series and panel data. xtbreak
can detect the existence of breaks, determine their number and location, and
provide break date confidence intervals. The new command is used to explore
changes in the relationship between COVID–19 cases and deaths in the US using
both country-level time series data and state-level panel data.

###### keywords:

Structural breaks; Time series data; Panel data; Cross-section dependence;
COVID–19; xtbreak.

##  1 Introduction

In economics and elsewhere linear relationships between dependent and
explanatory variables are at the core of interest. To investigate such
relationships, observations over time for one or more cross-sectional units
such as firms, individuals, or countries are collected and are subsequently
used in estimating the coefficients of regression models. A key assumption
here is that the coefficients do not change over time. This assumption is
unlikely to hold, especially for longer periods of time, because of major
disruptive events, such as financial crises. Parameter instability can have a
detrimental impact on estimation and inference, and can lead to costly errors
in decision-making. The times in which the parameters change are called
“change points” in the statistics literature and “structural breaks” in
economics. As both terms are synonymous to each other, in the following we
will use the latter term or just “breaks”.

The aim of this paper is to propose a new community contributed Stata package
called xtbreak.111Updates will be continuously provided on our GitHub page:
GitHub. The package implements the methods developed by Bai and Perron (1998)
for the case of pure time series, and Ditzen et al. (2021) in the case of
panel data.222The Ditzen et al. (2021) study builds on earlier work by
Karavias et al. (2021) in the case of a single break.

xtbreak provides researchers with a complete toolbox for analysing multiple
structural breaks in time series and panel data. It can detect and date an
unknown number of breaks at unknown break dates. The toolbox is based on
asymptotically valid tests for the presence of breaks, a consistent break date
estimator, and a break date confidence interval with correct asymptotic
coverage. In fact, xtbreak includes no less than three tests; (i) a test of no
structural change against the alternative of a specific number of changes,
(ii) a test the null hypothesis of no structural change against the
alternative of an unknown number of structural changes, and (iii) a test of
the null of $s$ changes against the alternative of $s+1$ changes. The package
also includes an algorithm that employs the last test consecutively in order
to estimate the true number of breaks. The tested break dates can be unknown
or user-defined, as when researchers have additional information and wish to
examine whether there was a break in a specific point in time. Once the
presence of breaks has been tested and confirmed, xtbreak estimates the
locations of the breaks and provides the associated confidence intervals.

A large number of breaks does not translate into heavy computational burden,
as xtbreak implements an efficient dynamic programming method described in Bai
and Perron (2003), which ensures that there are $O(T^{2})$ computations, even
with more than two breaks.

xtbreak can deal with models of “pure” or “partial” structural change. A pure
structural change model is one in which the coefficients of all explanatory
variables change, while in a partial structural change model only a subset of
the coefficients change.

xtbreak is applicable used under very general conditions. In case of panel
data, the tools can be used even if the model errors are dependent and
heteroskedastic across both time and cross-sectional units. The cross-
sectional dependence is assumed to have an “interactive effects”, or “common
factor”, structure, which means that the dependence is of the strong form. We
also allow the regressors to load on the same set of factors as the errors,
which means that they may be endogenous. The allowable dependencies over time
are also very general. The only requirement is that they cannot be strong, as
in the presence of unit roots.

The works of Bai and Perron (1998), and Ditzen et al. (2021) draw on the
economics literature. However, structural breaks are not confined to economics
but happen also in other fields of research, including engineering,
epidemiology, climatology, and medicine. xtbreak is therefore widely
applicable. To showcase this width, we consider as an example the
epidemiological relationship between COVID–19 cases and deaths. Using both
aggregate country and disaggregated state level US data, we find evidence of
multiple breaks. In particular, we find that an increase in the number of
COVID–19 cases lead to more deaths in the beginning of the pandemic than in
later waves.

The remainder of the paper is organized as follows: Section 2 presents the
model that we will be considering. We focus on the panel case, which in most
regards includes the pure time series setup as a special case. Important
differences are brought up and discussed. Section 3 presents the hypothesis
tests and Section 4 the break estimation procedure. Section 5 presents the
xtbreak command. Section 6 contains the empirical analysis of the relationship
between COVID–19 cases and deaths. Section 7 concludes the paper. Section 8
includes instructions on installing xtbreak, and Sections 9 and 10 contain
acknowledgements and references, respectively.

##  2 Model discussion

We consider the following model with $N$ units, $T$ periods and $s$ structural
breaks:

$\displaystyle
y_{i,t}=x_{i,t}^{\prime}\beta+w_{i,t}^{\prime}\delta_{j}+e_{i,t},$ (1)

where $t=T_{j-1},...,T_{j}$ and $j=1,...,s+1$ with $T_{0}=0$ and $T_{s+1}=T$.
Hence, there are $s$ breaks, or $s+1$ regimes with regime $j$ covering the
observations $T_{j-1},...,T_{j}$. In order emphasise the break structure, we
can write (1) regime-wise;

$\displaystyle y_{i,t}$
$\displaystyle=x_{i,t}^{\prime}\beta+w_{i,t}^{\prime}\delta_{1}+e_{i,t}~{}\text{for}~{}t=T_{0},...,T_{1},$
$\displaystyle y_{i,t}$
$\displaystyle=x_{i,t}^{\prime}\beta+w_{i,t}^{\prime}\delta_{2}+e_{i,t}~{}\text{for}~{}t=T_{1},...,T_{2},$
$\displaystyle\vdots$ $\displaystyle y_{i,t}$
$\displaystyle=x_{i,t}^{\prime}\beta+w_{i,t}^{\prime}\delta_{s+1}+e_{i,t}~{}\text{for}~{}t=T_{s},...,T_{s+1}.$

For $N=1$, this is a time series model, while for $N>1$, it is a panel data
model. The dependent variable $y_{i,t}$ and the regression error $e_{i,t}$ are
scalars, while $x_{i,t}$ and $w_{i,t}$ are $p\times 1$ and $q\times 1$
vectors, respectively, of regressors. The coefficients of the regressors in
$x_{i,t}$ are unaffected by the breaks, while those of $w_{i,t}$ are affected
by the breaks. It is possible that all independent variables break, in which
case $x_{i,t}^{\prime}\beta$ is defined to be zero. The break dates are common
for all units. This is a very common assumption that is reasonable in settings
where the frequency of the data is not high. Let
$\mathcal{T}_{s}=\\{T_{1},...,T_{s}\\}$ be a collection of $s$ break dates
such that $T_{j}=\lfloor\lambda_{j}T\rfloor$, where
$\lambda_{0}=0<\lambda_{1}<...<\lambda_{s}<\lambda_{s+1}=1$. By specifying the
breaks in this way we ensure that they are distinct from one another and that
they are bounded away from the beginning and end of the sample. This is
important because we need to be able to estimate the model within each regime.

In case the data has a panel structure ($N>1$), we allow for unobserved
heterogeneity in the form of interactive effects:

$e_{i,t}=f_{t}^{\prime}\gamma_{i}+\varepsilon_{i,t},$ (2)

where $f_{t}$ is an $m\times 1$ vector of factors and $\gamma_{i}$ is a
conformable vector of factor loadings.333We use the term “unobserved
heterogeneity”, although $f_{t}$ might be known. Later on we elaborate on
this. The fact that $f_{t}$ is common to all cross-sectional units $i$ means
that the regression errors can be strongly cross-sectionally correlated. This
specification is very general and nests the usual one-way and two-way fixed
effects models as special cases. Both $f_{t}$ and $\varepsilon_{i,t}$ may be
weakly serially correlated, but they cannot be correlated with each other and
$\varepsilon_{i,t}$ cannot be cross-sectionally correlated. This ensures that
any cross-section dependence in $e_{i,t}$ originates with $f_{t}$.

Typically there is a lot of cross-sectional co-movement not only in the
regression errors but also in the regressors. To account for this, we assume
that $x_{i,t}$ and $w_{i,t}$ are generated in the following way:

$\displaystyle x_{it}=\Gamma_{x,i}^{\prime}f_{t}+u_{x,i,t},$ (3)
$\displaystyle w_{it}=\Gamma_{w,i}^{\prime}f_{t}+u_{w,i,t},$ (4)

where $\Gamma_{x,i}$ and $\Gamma_{w,i}$ are $p\times m$ and $q\times m$
matrices, respectively, of factor loadings, while $u_{x,i,t}$ and $u_{w,i,t}$
are $p\times 1$ and $q\times 1$ vectors, respectively, of idiosyncratic errors
that are independent of all the other random elements of the model. The model
described by (1)–(4) above is the same as the one considered by Ditzen et al.
(2021).444The factor-in-regressors condition rules out lags of the dependent
variable as regressors in the panel case. Lagged dependent variables are,
however, not ruled out in the time series case (see Bai and Perron, 1998).

The fact that $x_{i,t}$ and $w_{i,t}$ are allowed to load on the same set of
factors as $e_{i,t}$ means that they can be endogenous. This type of
endogeneity through unobserved heterogeneity is standard in panel data. Here
we are considering interactive effects, but the idea is the same in the fixed
effects case; the effects sitting in errors might also be in the regressors,
which means that they have to be removed prior to estimation. In the fixed
effects case, one augments (1) by dummy variables, which is tantamount to
transforming the variables into deviations from means. Here a more elaborate
augmentation approach is needed, as to be expected since interactive effects
are more general than fixed effects. Had the factors been known, which would
be the case if i.e. the unobserved heterogeneity is made up of known
deterministic terms, we would have estimated

$\displaystyle
y_{i,t}=x_{i,t}^{\prime}\beta+w_{i,t}^{\prime}\delta_{j}+f_{t}^{\prime}\gamma_{i}+\varepsilon_{i,t}$
(5)

by ordinary least squares (OLS). This is possible because with $f_{t}$ as a
regressor the regression error is no longer given by $e_{i,t}$ but by
$\varepsilon_{i,t}$, which is independent of the regressors. If, on the other
hand, $f_{t}$ is not known, then we need a good proxy to use in its
stead.555Take the so-called “wage curve” model, which relates worker’s wages
to the rate of unemployment, and is the most common motivating example in the
literature (see, for example, Bai, 2009). Here the factor loadings may
represent workers’ unobservable skills, such as innate ability, perseverance,
and motivation, and the factors would represent the price of these skills,
which are not necessarily constant over time. Ditzen et al. (2021) use
$\bar{x}_{t}=N^{-1}\sum_{i=1}^{N}x_{i,t}$ and
$\bar{w}_{t}=N^{-1}\sum_{i=1}^{N}w_{i,t}$, and therefore so do we.666The
intuition for why argumentation by $\bar{x}_{t}$ is needed is simple. We begin
by noting that by (3),
$\bar{x}_{t}=\bar{\Gamma}_{x}^{\prime}f_{t}+\bar{u}_{x,t}$, where
$\bar{\Gamma}_{x}$ and $\bar{u}_{x,t}$ are the cross-sectional averages of
$\Gamma_{x,i}$ and $u_{x,i,t}$, respectively. Hence, provided that $u_{x,i,t}$
is mean zero and independent across $i$, by a central limit law,
$\bar{x}_{t}\to_{p}\bar{\Gamma}_{x}^{\prime}f_{t}$ as $N\to\infty$, where
“$\to_{p}$” signify convergence in probability. We say that $\bar{x}_{t}$ is
“rotationally consistent” for $f_{t}$, which is enough if the purpose is to
control for $f_{t}$. The intuition for why $\bar{w}_{t}$ is need is analogous.
The appropriately augmented version of (1) is therefore given by

$\displaystyle
y_{i,t}=x_{i,t}^{\prime}\beta+w_{i,t}^{\prime}\delta_{j}+\bar{x}_{t}^{\prime}a_{i}+\bar{w}_{t}^{\prime}b_{i,j}+\text{error}.$
(6)

Because asymptotically observing the cross-sectional averages is just as good
as observing the true factors, the regressors in (6) are asymptotically
exogenous. This means that the estimation can be carried out using OLS. This
is the same idea as in the “common correlated effects” (CCE) estimator of
(Pesaran, 2006), with the difference that here we do not include the cross-
sectional average of $y_{i,t}$ as a regressor in (6) (see Karavias et al.,
2021, for a discussion). If $f_{t}$ is neither completely known, nor
completely unknown, as is usually the case in practice, then the cross-
sectional averages will take care of the unknown factors and the known factors
can be added to (6) as additional regressors.777The cross-sectional averages
can in principle capture all factors, regardless of whether they are observed
(known) or not. An important condition for this to work is, however, that the
number of cross-section averages is not fewer than the number of factors they
replace. Because of this it is a good idea to treat known factors as
additional regressors in (6), as it makes it possible to estimate more unknown
factors.

If $N=1$, such that (1) is a time series model, then by definition there is no
cross-sectional variation that we can exploit to estimate unknown factors.
Hence, in this case $f_{t}$ must be known, and hence the model to be estimated
is given by (5), which is then the same as in Bai and Perron (1998).

##  3 The toolbox

###  3.1 Hypotheses testing

This section presents the first set of tools, which are necessary for
establishing that structural change has happened and for determining the
number of structural breaks, $s$. In particular, we consider tests of three
hypotheses, labelled “(A)”–“(C)”, and a sequential test to determine $s$. We
begin by stating the hypotheses of interest.

  1. (A)

$H_{0}$: no breaks versus $H_{1}$: $s$ breaks, where the number of breaks
under $H_{1}$, $s$, is specified by the researcher.

  2. (B)

$H_{0}$: no breaks versus $H_{1}$: $1\leq s\leq s_{max}$ breaks, where the
maximum number of breaks under $H_{1}$, $s_{max}$, is specified by the
researcher.

  3. (C)

$H_{0}$: $s$ breaks versus $H_{1}$: $s+1$ breaks, where $s$ is specified by
the researcher.

To test hypotheses (A)–(C) we employ a number of test statistics. The time
series versions of these tests have appeared in Bai and Perron (1998), while
the panel versions have appeared in Ditzen et al. (2021).

#### Hypothesis (A)

If the dates of the breaks are known, the test that we are going to consider
for hypothesis (A) is simply a Chow test. Let us therefore denote by
$F(\mathcal{T}_{s})$ the $F$-statistic for testing the null of no breaks
versus the alternative of $s$ known breaks at dates $\mathcal{T}_{s}$, which
in the time series case is based on (5), while in the panel case it is based
on (6). Appropriate critical values can be taken from the $F$ distribution
with $s$ numerator degrees of freedom and $N(T-p-(s+1)q)-p-(s+1)q$ denominator
degrees of freedom.

If $\mathcal{T}_{s}$ is unknown, which is most likely in practice, then the
following supremum statistic is used:

$\mathrm{sup}F(s)=\sup_{\mathcal{T}_{s}\in\mathcal{T}_{s,\epsilon}}F(\mathcal{T}_{s}).$
(7)

Here

$\mathcal{T}_{s,\epsilon}=\\{(T_{1},...,T_{s}):T_{j+1}-T_{j}\geq\epsilon
T,T_{1}\geq\epsilon T,T_{s}\leq(1-\epsilon)T\\},$ (8)

is the set of permissible break dates with $\epsilon$ being a user-defined
trimming parameter. By setting $\epsilon\in(0,1)$ we ensure that the breaks
considered in the test are distinct and bounded away from the sample
endpoints, as assumed.

#### Hypothesis (B)

Hypothesis (B) can be tested using the following double maximum statistic:

$\mathrm{WDmax}F(s_{max})=\max_{1\leq s\leq
s_{max}}\frac{c_{\alpha,1}}{c_{\alpha,s}}\mathrm{sup}F(s),$ (9)

where $c_{\alpha,s}$ is the critical value of $\mathrm{sup}F(s)$ at
significance level $\alpha$ and $s$ breaks. The weighting by
$c_{\alpha,1}/c_{\alpha,s}$ here ensures that the marginal $p$-values of the
weighted supremum statistics are all equal. This counterweights the decrease
in the marginal $p$-value of $\mathrm{sup}F(s)$ that comes from increasing
$s$, and the resulting loss of power when $s$ is large. The test statistic can
also be unweighted in which case we set $c_{\alpha,1}/c_{\alpha,s}=1$ for all
$s$.

#### Hypothesis (C)

In Section 4, we describe a procedure for how to estimate the break dates. Let
$\widehat{\mathcal{T}}_{s}=\\{\widehat{T}_{1},...,\widehat{T}_{s}\\}$ be the
set of estimated breaks obtained based on that procedure. For the test of
hypothesis (C) we use the following statistic:

$F(s+1|s)=\sup_{1\leq j\leq
s+1}\sup_{\tau\in\widehat{\mathcal{T}}_{j,\epsilon}}F(\tau|\widehat{\mathcal{T}}_{s}).$
(10)

where $\widehat{\mathcal{T}}_{s}$ contains estimates of the $s$ break
stipulated under the hull hypothesis, $\tau$ is the additional $(s+1)$-th
break under the alternative, and

$\widehat{\mathcal{T}}_{j,\epsilon}=\\{\tau:\widehat{T}_{j-1}+(\widehat{T}_{j}-\widehat{T}_{j-1})\epsilon\leq\tau\leq\widehat{T}_{j}-(\widehat{T}_{j}-\widehat{T}_{j-1})\epsilon,\widehat{T}_{0}=0,\widehat{T}_{s+1}=1\\}$
(11)

is the set of permissible breaks in between the estimated $(j-1)$-th and
$j$-th breaks. Hence, $F(s+1|s)$ is testing the null of $s$ breaks versus the
alternative that there is an additional break somewhere within the regimes
stipulated under the null. Finally, $F(\tau|\widehat{\mathcal{T}}_{s})$ is the
$F$-statistic based on taking the estimated break dates in
$\widehat{\mathcal{T}}_{s}$ as given and testing for one additional break at
$\tau$.

The $F(s+1|s)$ test can be applied sequentially to estimate the number of
breaks. In this case, we start by testing the null of no breaks against the
alternative of a single break using $F(1|0)$. If the null is accepted, we set
$\widehat{s}=0$ and terminate the procedure. If, however, the null is
rejected, we estimate the breakpoint, denoted $\widehat{T}_{1}$, and split the
sample in two at $\widehat{T}_{1}$. We then test for the presence of a break
in each of the two subsamples using $F(2|1)$. If no breaks are found, we set
$\widehat{s}=1$ and stop, whereas if breaks are detected, we estimate their
location and split the sample again. This process continues until the test
fails to reject.

The asymptotic distributions of the above tests in the pure time series and
panel cases can be found in Bai and Perron (1998), and Ditzen et al. (2021),
respectively. Because the distributions are the same, so are the critical
values. xtbreak therefore uses the critical values of Bai and Perron (1998),
and Bai and Perron (2003), which are applicable for
$\epsilon\in\\{0.05,0.1,0.15,0.2,0.25\\}$. In theory, the validity of the
critical values requires $T\to\infty$ in the time series case and
$N,\,T\to\infty$ with $T/N\to 0$ in the panel case, which in practice means
that $T$ should be “large” in both cases, and that $N$ should be even larger
in the panel case. For some Monte Carlo evidence on the accuracy of these
predictions, we make reference to Bai and Perron (2003), and Ditzen et al.
(2021).

##  4 Break date estimation

The previous section was focused on testing for the existence of breaks, and
on determining their number. As soon as a number of breaks is detected,
interest turns to their location, as it is the dates of the breaks that
researchers use to identify the underlying cause of change.

The standard approach in the literature is to estimate breaks by minimizing
the sum of squared residuals. Bai and Perron (1998), and Ditzen et al. (2021)
do the same. The break date estimator included in xtbreak is therefore given
by

$\widehat{\mathcal{T}}_{s}=\arg\min_{\mathcal{T}_{s}\in\mathcal{T}_{s,\varepsilon}}SSR(\mathcal{T}_{s}),$
(12)

where $SSR(\mathcal{T}_{s})$ is the sum of squared residuals based on $s$
breaks. In the time series case the residuals are taken from (5), whereas in
the panel case they are taken from (6). If $s$ is “small”, the minimization
can be done by grid search. If, however, $s$ is “large”, then grid search,
which requires $O(T^{s})$ OLS operations, becomes computationally very costly
and possibly even infeasible. In such cases, the efficient dynamic programming
algorithms of Bai and Perron (1998, 2003), and Ditzen et al. (2021), which
limit the number of operations to $O(T^{2})$ for any $s$, can be used.

Once $\widehat{\mathcal{T}}_{s}$ has been obtained, confidence intervals for
each estimated break date can be constructed using the formulas given in Bai
and Perron (1998), and Ditzen et al. (2021).

##  5 The xtbreak command

###  5.1 Syntax

#### Automatic estimation of number of breaks and breakdates

xtbreak depvar $\bigl{[}$ indepvars $\bigr{]}$ $\bigl{[}$ if $\bigr{]}$
$\bigl{[}$ , options1 options2 options5 $\bigr{]}$

estimates the number of breaks and breakdates with no prior knowledge on
number and location of breaks. Estimation of the number of breaks is based on
the sequential test of Hypothesis (C).

#### Testing for known structural breaks

xtbreak test depvar $\bigl{[}$ indepvars $\bigr{]}$ $\bigl{[}$ if $\bigr{]}$
$\bigl{[}$ , breakpoints(numlist|datelist $\bigl{[}$ ,index|fmt(string)
$\bigr{]}$) options1 options5 $\bigr{]}$

implements Hypothesis (A): testing for breaks if the break dates are known.

#### Testing for unknown structural breaks

xtbreak test depvar $\bigl{[}$ indepvars $\bigr{]}$ $\bigl{[}$ if $\bigr{]}$
$\bigl{[}$ , hypothesis(1|2|3) breaks(real) options1 options2 options3
options4 options5 $\bigr{]}$

implements Hypotheses (A)-(C): testing for breaks if the break dates are
unknown.

#### Estimation of breakdates

xtbreak estimate depvar $\bigl{[}$ indepvars $\bigr{]}$ $\bigl{[}$ if
$\bigr{]}$ $\bigl{[}$ , breaks(real) showindex options1 options2 options5
$\bigr{]}$

estimates breakdates for a given number of breaks.

#### Updating xtbreak

xtbreak update

obtains the latest version from GitHub.

#### Specific Options

options1 are general options and apply to xtbreak in general:

breakconstant noconstant nobreakvariables(varlist1) vce(type)

options2 are specific for unknown break dates:

trimming(real)

options3 are specific for unknown breakdates and hypothesis(2):

wdmax level(#)

options4 are specific for unknown breakdates and hypothesis(3):

sequential

options5 are panel data specific:

breakfixedeffects nofixedeffects csd csa(varlist) csanobreak(varlist)
kfactors(varlist) nbkfactors(varlist)

Data must be [XT] tsset or [XT] xtset before using xtbreak. depvar, indepvars
and varlist may contain time-series operators, see [TS] tsvarlist.

###  5.2 Description of options

breakpoints(numlist|datelist [,index|fmt(format)]) specifies the known
breakpoints. Known breakpoints can be set by either the number of the
corresponding observations or by the values 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 10-th observation in time. datelist
takes a list of dates. For example, breakpoints(2010Q1, fmt(tq)) specifies a
break in the first quarter of 2010. The option fmt() specifies the format and
is required if a datelist is used. The format set in breakpoints() and the
time identifier needs to be the same.

breaks(#) specifies the number of unknown breaks under the alternative. For
hypothesis (B), breaks() can include two values. For example, breaks(4 6)
amounts to testing the null of no breaks against the alternative of 4–6
breaks. If only one value specified, then the lower bound of the number of
breaks under the alternative is set to 1. If hypothesis (C) is tested, then
breaks() defines the number of breaks under the alterantive. If the sequential
test approach is used, then breaks() is maximum number of breaks.

showindex show confidence intervals as index.

hypothesis(1|2|3) specifies which hypothesis to test. Specify h(1) for
hypothesis (A), h(2) for hypothesis (B) and h(3) for hypothesis (C).

breakconstant break in constant. Default is no breaks in the constant term.

noconstant suppresses constant.

breakfixedeffects break in individual fixed effects.

nofixedeffects suppresses individual fixed effects.

nobreakvariables(varlist1) defines variables with no structural breaks.
varlist1 can contain time series operators.

vce(type) specifies the covariance matrix estimator. The options are: ssr
(homoskedastic errors), hac (heteroskedastic and autocorrelation robust), hc
(heteroskedastic robust) and np (the non-parametric estimator of Pesaran,
2006).

trimming(string) specifies the trimming parameter in percent. The trimming
affects the minimal time periods between two breaks. The default is 15%
(0.15). Critical values are available for %5, 10%, 15%, 20% and 25%.

wdmax weights the double maximum test statistic used for testing hypothesis
(B). The default is not to use any weights.

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

csa(varlist) specifies the variables with breaks which are added as cross-
sectional averages. xtbreak calculates internally the cross-sectional
averages.

csanobreak() is the same as csa() but for variables without a break.

csd implements csa(w) csanobreak(x) automatically. For example, the variables
in w would enter with breaks, while those in x, specified with the
nobreakvariables(varlist1), enter without breaks.

kfactors(varlist) Variables in varlist are known factors, variables in the
data which are constant across the cross-sectional dimension. Examples are
seasonal dummies or other observed common factors such as asset returns and
oil prices. The factors in this list are affected by structural breaks in that
their loadings change.

nbkfactors(varlist) Same as above, but the factors in this list are not
affected by structural breaks.

xtbreak detects automatically if $N=1$ or $N>1$. The user therefore does not
have to specify if the data have a time series or a panel structure.

###  5.3 Stored values

xtbreak estimate stores the following in e():

Matrices |
---|---
e(breaks) |  Matrix with break dates
e(CI) |  Confidence intervals with dimension 4 $\times$ number_breaks

xtbreak test stores the following in r() for known breakpoints:

Scalars |  |  |
---|---|---|---
r(Wtau) |  Value of test statistic |  r(p) |  $p$-value from $F$ distribution

For unknown breakpoints the following is stored:

Scalars |  |  |
---|---|---|---
r(supWtau) |  Value of the $\mathrm{sup}F(s)$ statistic (hypothesis (A)) |  r(Dmax) |  Value of unweighted double maximum test statistic (hypothesis (B))
r(WDmax) |  Value of weighted double maximum test statistic (hypothesis (B)) |  r(f) |  Value of the $F(s+1|s)$ statistic (hypothesis 3)
r(c90) |  Critival value at the 90% level |  r(c95) |  Critival value at the 95% level
r(c99) |  Critival value at the 99% level |  |

###  5.4 Postestimation

The following postestimation commands can be used after xtbreak estimate:

estat indicator [newvar]

creates an indicator variable $(1,...,1,2,...,2,...,s+1,...,s+1)^{\prime}$
that specifies all break regimes. To split a varlist according to the
estimated breakpoints

estat split varlist

and to draw a scatter plot of the variable with break on the x-axis and the
dependent variable in the y-axis:

estat scatter varname

estat indicator creates a new variable of the form
$(1,...,1,2,...,2,...,s+1,...,s+1)^{\prime}$ and where the value changes for
each break regime. estat split splits the variables defined in varlist
according to the breakdates. estat split saves the names of the created
variables in r(varlist). estat scatter draws a scatter plot with the dependent
variable on the y-axis and a variable with breaks defined in varname on the
x-axis.

###  5.5 On the choice of factors in the panel case

xtbreak is versatile in dealing with common factors through the options csd,
csa(), csanobreak(), kfactors() and nbkfactors(). It allows for both known and
unknown factors. Unknown factors are estimated by the cross-sectional averages
specified in csa() and csanobreak(), or alternatively in csd. Known factors
can be dummy variables, and other observed variables that are common to all
cross-sectional units and are defined by kfactors() and nbkfactors(). Whenever
available, such factors should be included as they make it possible to
estimate more unknown factors. These factors can be free of breaks or they can
be allowed to be affected by the break. Fixed effects are known factors but
are treated differently, though, because of their wide use and in order for
xtbreak’s command structure to be similar to the rest of the Stata commands.
In particular, one has to specify whether xtbreak should estimate a model with
or without overall constant/individual fixed effects. In total, xtbreak
supports five different models depending on this specification. There are
presented in Table 1. The default is a model with fixed effects.

Specification | Options
---|---
Individual fixed effects |  noconstant*
Fixed effects with breaks |  breakfixedeffects noconstant
Overall constant |  nofixedeffects
Constant with breaks |  breakconstant nofixedeffects
Nothing |  noconstant nofixedeffects

_Notes_ : * is the default. Option noconstant not necessary.
---

Table 1: Constant/fixed effects model specifications.

The choice of deterministic model has implications for the structural break
analysis. In the constant-only model, the constant is treated as a regular
regressor and we can test and detect breaks in it. In fact, the constant may
be the only regressor. With fixed effects, xtbreak cannot consider a model
without breaking regressors ($w_{i,t}$) and it cannot detect or estimate
breaks that affect only the fixed effects and not the regressors. However, the
analysis of the breaking regressors is unaffected should some or indeed all
breaks affect the fixed effects.

##  6 Empirical application to COVID–19 deaths and cases

###  6.1 Time series evidence for the whole US

#### Main results

In this section, we explain the use and options of xtbreak. We want to test if
we can identify structural breaks in the relationship between the number of
COVID–19 deaths and cases in the US in 2020 and 2021. To do so we use weekly
data on the number of deaths and new cases from the CDC. The dataset is also
available on our GitHub page.

We want to estimate the following model:

$\displaystyle\mathrm{DEATHS}_{t}=\beta_{0}+\delta_{1}\mathrm{CASES}_{t-1}+\text{error},$
(13)

where $\mathrm{DEATHS}_{t}$ and $\mathrm{CASES}_{t}$ are the reported deaths
due to COVID–19 in week $t$ as defined by the CDC, and the number of new cases
for the entire US in the same week, respectively. We assume that on average a
week lies between a positive test and a possible death.888Note that since we
use weekly data, the difference can be up to 13 days. Monday is taken as the
first day of a given week. The data ranges from 27 January 2020 (beginning of
week 4) to 29 August 2021 (end of week 34).

Figure 1: Plotting COVID–19 deaths and cases over time.

We want to test if $\beta_{0}$ and $\delta_{1}$ are exposed to structural
changes. There are several reasons for believing that the relationship between
the number of new cases and deaths might have changed. In the beginning of the
pandemic the understanding and best way to treat the disease was not very
developed. The numbers were also under-reported due to limits in testing
capacity and reporting routines. With better testing capacity, reporting
routines and treatments, the relationship is expected to change, especially
after the first two waves, because of the knowledge gained. Starting in mid-
December 2020, vaccines were introduced, and hence the relationship between
the number of cases and deaths might be expected to have changed again. It
therefore seems reasonable to expect at least two breaks.

Figure 1 plots the number of deaths and cases over time. The first thing to
note is the striking difference between the number of deaths and cases in the
first wave with the number of deaths being many times larger than the number
of new cases. This difference is markedly smaller in the second wave but still
the number of deaths is highest. The third wave was the worst in terms of
numbers by far, but the number of deaths per new case was much lower than
before. From about week 29 in 2020 the number of cases started to pick up
again, and so did the number of deaths.

We can use xtbreak without any prior knowledge of the number of breaks or
their exact dates. We use the following command line:

  *

        . xtbreak deaths L.cases

    Sequential test for multiple breaks at unknown breakpoints
    (Ditzen, Karavias & Westerlund. 2021)

                                      Bai & Perron Critical Values
                         Test          1% Critical     5% Critical    10% Critical
                      Statistic          Value            Value           Value

     F(1|0)             107.50            12.29            8.58            7.04
     F(2|1)              31.25            13.89           10.13            8.51
     F(3|2)               6.96            14.80           11.14            9.41
     F(4|3)               1.18            15.28           11.83           10.04
     F(5|4)               4.95            15.76           12.25           10.58

    Detected number of breaks:                2               2               2

    The detected number of breaks indicates the highest number of
     breaks for which the null hypothesis is rejected.

    Estimation of break points
                                                               T    =     82
                                                               SSR  =    226.85
                                                          Trimming  =      0.15

      #      Index     Date                          [95% Conf. Interval]

      1        16      2020w20                       2020w19        2020w21
      2        59      2021w11                       2021w9         2021w13

xtbreak determines the number of breaks using the sequential testing approach
described in Section 3.1. The maximum number of breaks is $s_{max}=5$.999The
maximum permissible number of breaks depends on the minimal length of the
subsamples considered, and hence on the trimming parameter $\epsilon$. The
maximum number of breaks is given by the formula $\lceil 1/\epsilon\rceil-2$,
where $\lceil\cdot\rceil$ is the smallest greater integer function. For
$\epsilon=0.15$ the permissible number of breaks is $5$, while for
$\epsilon=0.10$ it is $8$ and for $\epsilon=0.05$ it is $18$. It reports the
test value at each step in the sequence and the appropriate critical value.
The number of breaks is increased by one every time the test is able to reject
the null, starting at 0 breaks. We see that 0 breaks is rejected in favour of
at least 1 break and that 1 break is rejected in favour of at least 2 breaks,
but then when testing 2 breaks against 3 or more breaks the test is no longer
able to reject. We therefore conclude that there are 2 breaks. We also get the
estimated break dates and the associated confidence intervals. The first break
is estimated to week 20 of 2020 (third week of May), while the second is
estimated to week 11 of 2021 (third week of March). The confidence intervals
on both breaks span only a couple of weeks, suggesting that the estimates are
precise.

xtbreak saves the values of the breakpoints in e(breaks) and the confidence
intervals in e(CI). The matrices contain the index number $t\in\\{1,...,T\\}$
of the breaks and the bound of the confidence intervals. We can use this
information to draw Figure 2, in which the estimated break dates and their 95%
confidence intervals are plotted in the same graph as the deaths and the
lagged number of cases.101010The code is available in the accompanying do
file.

Figure 2: Plotting estimated breaks (dashed lines), 95% confidence intervals
(dotted lines), deaths and lagged cases.

Next we can use the estat function of xtbreak to generate new variables for
each break regime and run a simple OLS regression:

  *

        . estat split
    New variables created: L_cases1 L_cases2 L_cases3

    . reg deaths `r(varlist)´

          Source         SS           df       MS      Number of obs   =        82
                                                        F(3, 78)        =    338.24
           Model    2951.18975         3  983.729918   Prob > F        =    0.0000
        Residual    226.851495        78   2.9083525   R-squared       =    0.9286
                                                        Adj R-squared   =    0.9259
           Total    3178.04125        81  39.2350771   Root MSE        =    1.7054

          deaths   Coefficient  Std. err.      t    P>|t|     [95% conf. interval]

        L_cases1     .0589407   .0036153    16.30   0.000     .0517433    .0661381
        L_cases2     .0136155     .00045    30.26   0.000     .0127196    .0145114
        L_cases3     .0064061   .0009669     6.63   0.000     .0044812    .0083311
           _cons     1.304738   .3097613     4.21   0.000      .688051    1.921426

The estimate for the first regime covering the period from week 4 of 2020 to
week 20 of 2020 suggests that for each additional 1,000 COVID–19 cases around
59 people died. According to Figure 2, the end date of this regime coincides
with the end of the first wave. This estimate is quite high, which can be
explained by the relatively small number of tests conducted at that time. The
estimated effect of the number of cases is much lower in the second regime,
which stretches week 21 of 2020 to week 10 of 2021. Only 14 out of an
additional 1,000 infected died. In the third and last regime, which starts in
week 11 of 2021, the estimated effect reduces even further, to 6 deaths per
1,000 infected. This is probably partly due to vaccination roll-out, which
began in week 51 of 2020.

#### Additional results and discussions

This section is divided in two; (i) additional test results and (ii)
additional estimation results. We begin by considering some additional test
results, starting with a test of hypothesis (A). Specifically, we test the
null hypothesis of no breaks against the alternative of a break in week 20 in
2020 and another break in week 11 in 2021 using the regular Chow $F$-test.
There are the results:

  *

        . xtbreak test deaths L.cases , hypothesis(1) breakpoints(2020W20 2021w11, fmt(tw))
    Test for multiple breaks at known breakdates
    (Bai & Perron. 1998. Econometrica)
    H0: no breaks vs. H1: 2 break(s)

     W(tau)        =      134.70
     p-value (F)   =        0.00

The test value is 134.7, which is way out in the critical region of the $F$
distribution. We can therefore comfortably reject the null of no breaks. To
test the same hypothesis but with unknown break dates, we specify breaks(2).
The results look as follows:

  *

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

    Test for multiple breaks at unknown breakdates
    (Bai & Perron. 1998. Econometrica)
    H0: no break(s) vs. H1: 2 break(s)

                                      Bai & Perron Critical Values
                         Test          1% Critical     5% Critical    10% Critical
                      Statistic          Value            Value           Value

     supW(tau)          134.70             9.36            7.22            6.28

    Estimated break points:  2020w20 2021w11
    Trimming: 0.15

The test value is identical to before, as is the conclusion to reject the null
hypothesis, which is to be expected because the given break dates were set to
the estimated breaks obtained earlier. The difference is that when the breaks
are treated as unknown, the critical values come from a non-standard
distribution, because the statistic is the supremum of $F$-tests over all
possible break dates, as these are determined by the trimming parameter. These
critical values are more “honest” than those used for the Chow test, as they
account for the fact that the breaks are unknown. As a part of the test
results, xtbreak reports the estimated break dates used to construct the test,
and we can see that they coincide with those obtained earlier.

We now test the null of no breaks against the alternative of up to 5 breaks.
This is an example of a test of hypothesis (B), the results of which are
presented here below. As expected, the null hypothesis is firmly rejected.

  *

        . xtbreak test deaths L.cases , hypothesis(2) breaks(5)

    Test for multiple breaks at unknown breakdates
    (Bai & Perron. 1998. Econometrica)
    H0: no break(s) vs. H1: 1 <= s <= 5 break(s)

                                      Bai & Perron Critical Values
                         Test          1% Critical     5% Critical    10% Critical
                      Statistic          Value            Value           Value

     UDmax(tau)         149.05            12.37            8.88            7.46

    * evaluated at a level of 0.95.
    Trimming: 0.15

Next, we test the null of 2 breaks against the alternative of 3 breaks, which
is an example of hypothesis (C). We use the options hypothesis(3) and
breaks(3) to specify that there are 3 breaks under the alternative. The
results presented below suggest that we are unable to reject the null, which
is consistent with the estimated number of breaks.

  *

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

    Test for multiple breaks at unknown breakpoints
    (Bai & Perron. 1998. Econometrica)
    H0: 2 vs. H1: 3 break(s)

                                      Bai & Perron Critical Values
                         Test          1% Critical     5% Critical    10% Critical
                      Statistic          Value            Value           Value

     F(s+1|s)*            6.96            14.80           11.14            9.41

    * s = 2
    Trimming: 0.15

The sequential test results reported earlier can be obtained using the option
sequential with up to 5 breaks specified by the option breaks(5). The
appropriate command line is the following:

  *

        xtbreak test deaths L.cases , hypothesis(3) breaks(5) sequential

As a final test exercise, we consider two changes to the model. We begin by
investigating how the above results are affected if we allow for breaks in the
constant. To do so we use the sequential test but add the option
breakconstant;

  *

        xtbreak test deaths L.cases , breakconstant

To save space we omit the output, but we briefly describe it. xtbreak finds
one break, which if we investigate further occurs in week 20 of 2020. We also
investigate if the break is only in the constant, but not in the number of
cases. We keep the option breakconstant and move the variable L.cases to the
option nobreakvar(L.cases);

  *

        xtbreak test deaths , breakconstant nobreakvar(L.cases)

Again, xtbreaks detects one break which in this case is dated to week 22 of
2020. The confidence intervals of the last two examples both include week 20
of 2020.

We end this section with some comments on the estimation results. The break
date results reported earlier can be obtained using the option xtbreak
estimate. The appropriate command line is the following:

  *

        xtbreak estimate deaths L.cases , breaks(2)

As an illustration of the estimated regression model, we can draw a scatter
plot with different colours for the observations within each regime. The plot
can be created using xtbreak estat;

  *

        . estat scatter L.cases

The plot is displayed in Figure 3. The different colored markers represent the
observations within each regime, and the shape of the observations is
indicative of the strength of the estimated linear relationships and of their
slopes. In particular, we see that the slopes differ quite markedly between
regimes, which confirms the findings from the OLS regression.

Figure 3: Scatter plotting lagged cases against deaths by regime.

###  6.2 State level panel evidence

#### Main results

In this section, we use the same US data as in the previous section; however,
instead of aggregating the data up to the country level, we use data for all
50 US states, the District of Columbia, New York City, overseas territories
and three countries in free association with the US.111111The overseas
territories and three countries are; American Samoa, Guam, the Commonwealth of
the Northern Mariana Islands, Puerto Rico, the US Virgin Islands, the
Federated States of Micronesia, Republic of the Marshall Islands, and Republic
of Palau.

Similarly to before, we begin by reporting some results based on the
sequential test to estimate the number of breaks and the estimated break
dates. To account for potential heteroskedasticity and autocorrelation we use
robust (HAC) standard errors. xtbreak automatically detects if a panel data
model is used, and thus the syntax remains the same. These are the results:

  *

        . xtbreak deaths L.cases, vce(hac)

    Sequential test for multiple breaks at unknown breakpoints
    (Ditzen, Karavias & Westerlund. 2021)

                                      Bai & Perron Critical Values
                         Test          1% Critical     5% Critical    10% Critical
                      Statistic          Value            Value           Value

     F(1|0)              29.59            12.29            8.58            7.04
     F(2|1)              37.75            13.89           10.13            8.51
     F(3|2)              10.88            14.80           11.14            9.41
     F(4|3)              21.38            15.28           11.83           10.04
     F(5|4)               8.29            15.76           12.25           10.58

    Detected number of breaks:                4               4               4

    The detected number of breaks indicates the highest number of
     breaks for which the null hypothesis is rejected.

    Estimation of break points
                                                               N    =     60
                                                               T    =     82
                                                               SSR  =     37.78
                                                          Trimming  =      0.15

      #      Index     Date                          [95% Conf. Interval]

      1        15      2020w19                       2020w18        2020w20
      2        34      2020w38                       2020w37        2020w39
      3        47      2020w51                       2020w50        2020w52
      4        59      2021w11                       2021w10        2021w12

We see that the first time the null hypothesis cannot be rejected at the 1%
and 5% levels is when 2 breaks is tested against 3, implying 2 breaks.
However, we also see that 3 breaks is rejected against 4, suggesting that the
model might contain more than 2 breaks. The test procedure stops at 4 breaks,
but with 15% (default) trimming this is also the maximum number of breaks
allowed. Because of this, we now change the trimming from 15% to 10%, which
will make the search finer. Also, since this is a panel data set, we want to
allow for the possibility that there might be cross-sectional dependence. We
therefore augment the model by the cross-section average of the lagged number
of cases. Now the results look as follows:

  *

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

    Sequential test for multiple breaks at unknown breakpoints
    (Ditzen, Karavias & Westerlund. 2021)

                                      Bai & Perron Critical Values
                         Test          1% Critical     5% Critical    10% Critical
                      Statistic          Value            Value           Value

     F(1|0)              10.80            13.00            9.10            7.42
     F(2|1)               8.10            14.51           10.55            9.05
     F(3|2)              12.77            15.44           11.36            9.97
     F(4|3)               4.47            15.73           12.35           10.49
     F(5|4)               9.27            16.39           12.97           10.91
     F(6|5)               5.22            16.60           13.45           11.29
     F(7|6)               5.05            16.78           13.88           11.86
     F(8|7)               5.61            16.90           14.12           12.26
     F(9|8)               4.89            16.99           14.45           12.57

    Detected number of breaks:                .               3               3

    The detected number of breaks indicates the highest number of
     breaks for which the null hypothesis is rejected.

    Estimation of break points
                                                               N    =     60
                                                               T    =     82
                                                               SSR  =     25.99
                                                          Trimming  =      0.10

      #      Index     Date                          [95% Conf. Interval]

      1        15      2020w19                       2020w18        2020w20
      2        47      2020w51                       2020w50        2020w52
      3        57      2021w9                        2021w8         2021w10

    Cross-section averages:
      with breaks: L.cases

According to the results, there are no rejections at the 1% level, suggesting
a model without breaks. However, that seems unlikely given the evidence of
breaks reported so far. In interest of conservativeness, we therefore focus on
the results at the 5% and 10% levels, which lead to the same conclusion;
namely, 3 breaks.

#### Additional results and discussions

We start by testing the null of no breaks against to test the alternative of
up to 5 breaks. This is a test of hypothesis (B). Bai and Perron (2003)
recommend to always test this hypothesis before applying estimating the number
of breaks using the sequential test. These are the results:

  *

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

    Test for multiple breaks at unknown breakdates
    (Ditzen, Karavias & Westerlund. 2021)
    H0: no break(s) vs. H1: 1 <= s <= 5 break(s)

                                      Bai & Perron Critical Values
                         Test          1% Critical     5% Critical    10% Critical
                      Statistic          Value            Value           Value

     UDmax(tau)          12.20            13.07            9.52            8.05

    * evaluated at a level of 0.95.
    Trimming: 0.10
    Cross-section averages:
      with breaks: L.cases

As expected given the sequential test results, the test rejects at the 5% and
10% levels but not at the 1% level. This means that at the 5% and 10% levels
of significance there is evidence of up to 5 breaks. Next, we test the
hypothesis of no break against 1 break and then no break against 3 breaks. The
results are reported below. We see that the null of no breaks can be rejected
at a level of 5% in both cases, but that the evidence at the 1% level depends
on the number of breaks under the alternative. With 3 breaks under the
alternative, we reject also at the 1% level, which we take as evidence in
support of our earlier finding of 3 breaks.

  *

        . xtbreak test deaths L.cases, h(1) breaks(1) trimming(0.1) vce(hac) csa(L.cases)
    Test for multiple breaks at known breakdates
    (Karavias, Narayan & Westerlund. 2021)
    H0: no break(s) vs. H1: 1 break(s)

                                      Bai & Perron Critical Values
                         Test          1% Critical     5% Critical    10% Critical
                      Statistic          Value            Value           Value

     supW(tau)           10.80            13.00            9.10            7.42

    Estimated break points:  2020w19
    Trimming: 0.10
    Cross-section averages:
      with breaks: L.cases

  *

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

    Test for multiple breaks at unknown breakdates
    (Ditzen, Karavias & Westerlund. 2021)
    H0: no break(s) vs. H1: 3 break(s)

                                      Bai & Perron Critical Values
                         Test          1% Critical     5% Critical    10% Critical
                      Statistic          Value            Value           Value

     supW(tau)           12.20             8.42            6.84            6.09

    Estimated break points:  2020w19 2020w51  2021w9
    Trimming: 0.10
    Cross-section averages:
      with breaks: L.cases

We now take 3 breaks as given and proceed to estimate their locations. The
results are reported below. The estimated breaks take place in week 19 of
2020, in week 51 of 2020, and in week 9 of 2021. The confidence intervals for
all three breaks are narrow. When we compare these results to those reported
earlier based on the time series data set for the whole US, we see that the
first break date is almost identical, as is the third break in the panel data
set and the second break in the time series data set. Hence, for two of the
break dates, the panel data evidence reinforces the time series evidence
reported earlier. However, the panel data set also suggests that two breaks
are not enough, and that there is a need to account for a third break in week
51 of 2020. Thus is in mid-December 2020, which is just before the peak of the
third wave, as shown in Figure 4. The fact that the panel toolbox detects one
break that is not picked up by the time series toolbox could be due to the
gain in accuracy obtained by using the larger panel data set (see Ditzen et
al., 2021).

  *

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

    Estimation of break points
                                                               N    =     60
                                                               T    =     82
                                                               SSR  =     25.99
                                                          Trimming  =      0.10

      #      Index     Date                          [95% Conf. Interval]

      1        15      2020w19                       2020w18        2020w20
      2        47      2020w51                       2020w50        2020w52
      3        57      2021w9                        2021w8         2021w10

    Cross-section averages:
      with breaks: L.cases

Figure 4: Plotting estimated breaks (dashed lines), 95% confidence intervals
(dotted lines), deaths and lagged cases.

We now use estat split L.cases to generate new variables for each regime and
fit a simple fixed effects OLS regression to each. For comparison, we also
report some results based on the CCE estimator, which are obtained by using
xtdcce2 (Ditzen, 2018, 2021). The results are reported below. The CCE
estimator allows for interactive effects and is therefore more general than
fixed effects OLS. Interestingly enough, however, the results are very
similar. Similarly to the results reported earlier for the time series data
set, we see that the estimated coefficients in the first regime, which
corresponds to the first wave, are the highest. The coefficients drop in the
second regime, which includes the relatively calm summer of 2020, only to
increase again in the third regime, which is the peak of the third wave. In
the fourth and final regime, the estimated coefficients drop markedly when
compared to earlier regimes, which is most likely a vaccination effect.

  *

        . estat split L.cases
    New variables created: L_cases1 L_cases2 L_cases3 L_cases4

    . xtreg deaths `r(varlist)´, fe

    Fixed-effects (within) regression               Number of obs     =      4,920
    Group variable: ID                              Number of groups  =         60

    R-squared:                                      Obs per group:
         Within  = 0.8144                                         min =         82
         Between = 0.9721                                         avg =       82.0
         Overall = 0.8565                                         max =         82

                                                    F(4,4856)         =    5325.62
    corr(u_i, Xb) = 0.3305                          Prob > F          =     0.0000

          deaths   Coefficient  Std. err.      t    P>|t|     [95% conf. interval]

        L_cases1     .0745328   .0008793    84.76   0.000      .072809    .0762566
        L_cases2     .0123852   .0001553    79.77   0.000     .0120808    .0126895
        L_cases3     .0157277    .000136   115.67   0.000     .0154611    .0159942
        L_cases4     .0077951   .0002327    33.50   0.000     .0073389    .0082512
           _cons     .0172031   .0018211     9.45   0.000     .0136328    .0207734

         sigma_u    .03534295
         sigma_e    .10880368
             rho    .09544505   (fraction of variance due to u_i)

    F test that all u_i=0: F(59, 4856) = 7.29                    Prob > F = 0.0000

  *

        . estat split L.cases
    New variables created: L_cases1 L_cases2 L_cases3 L_cases4

    . xtdcce2 deaths `r(varlist)´, pooled(`r(varlist)´) cr(L.cases)
    (Dynamic) Common Correlated Effects Estimator - Pooled

    Panel Variable (i): ID                           Number of obs     =       4920
    Time Variable (t): date                          Number of groups  =         60

    Degrees of freedom per group:                    Obs per group (T) =         82
     without cross-sectional averages   = 77
     with cross-sectional averages      = 76
    Number of                                        F(124, 4796)      =      93.39
     cross-sectional lags               =  0         Prob > F          =       0.00
     variables in mean group regression = 4          R-squared         =       0.29
     variables partialled out           = 120        R-squared (P)     =       0.82
                                                     Root MSE          =       0.10
                                                     CD Statistic      =      48.41
                                                        p-value        =     0.0000

             deaths      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]

     Pooled:
           L_cases1   .0741296   .0251753    2.94    0.003       .024787   .1234723
           L_cases2   .0138424   .0018463    7.50    0.000      .0102237    .017461
           L_cases3   .0172933   .0027377    6.32    0.000      .0119276    .022659
           L_cases4   .0089277   .0027913    3.20    0.001      .0034567   .0143986

    Pooled Variables: L_cases1 L_cases2 L_cases3 L_cases4
    Cross Sectional Averaged Variables: L.cases
    Heterogenous constant partialled out.

##  7 Conclusion

This paper presents a new community contributed command, called xtbreak, which
enable researchers to detecting breaks, and to estimate their number and
location. The command can be applied to time series and panel data, and can
hence be seen as a complete break detection toolbox that is applicable
regardless of the structure of the data. In our empirical illustration, we
employ US country and state level date to investigate the relationship between
the number of COVID–19 cases and deaths, which may well have changed as a
result of improvements in testing capacity, reporting routines and treatments.
While the time series data set suggests 2 breaks, the panel data set suggests
3. Moreover, 2 out of the 3 breaks detected using the panel data set coincide
with those detected using the time series data set. Use of the relatively
larger panel data therefore leads to the detection of an additional break that
is not detected when using the time series data set.

##  8 How to install

The latest version of the xtbreak package can be obtained by typing the
following in Stata:

  *

        net from https://janditzen.github.io/xtbreak/

Updates and further documentation can be found on GitHub.

##  9 Acknowledgements

We are grateful to all participants of the Swiss, German and US Stata User
Group Meetings in 2020 and 2021. Ditzen acknowledges financial support from
Italian Ministry MIUR under the PRIN project Hi-Di NET - Econometric Analysis
of High Dimensional Models with Network Structures in Macroeconomics and
Finance (grant 2017TA7TYC). Westerlund acknowledges financial support from the
Knut and Alice Wallenberg Foundation through a Wallenberg Academy Fellowship.

## References

  * Bai and Perron (1998) Bai, B. Y. J., and P. Perron. 1998.  Estimating and Testing Linear Models with Multiple Structural Changes.  _Econometrica,_ 66(1): 47–78.
  * Bai and Perron (2003) Bai, J., and P. Perron. 2003.  Computation and analysis of multiple structural change models.  _Journal of Applied Econometrics_ 18(1): 1–22.
  * Ditzen (2018) Ditzen, J. 2018.  Estimating dynamic common-correlated effects in Stata.  _The Stata Journal_ 18(3): 585 – 617.
  * Ditzen (2021) . 2021.  Estimating long run effects and the exponent of cross-sectional dependence: an update to xtdcce2.  _The Stata Journal_ 21(3): 687–707.
  * Ditzen et al. (2021) Ditzen, J., Y. Karavias, and J. Westerlund. 2021.  Testing for Multiple Structural Breaks in Panel Data. Mimeo (available upon request) .
  * Karavias et al. (2021) Karavias, Y., J. Westerlund, and P. Narayan. 2021.  Structural Breaks in Interactive Effects Panels and the Stock Market Reaction to COVID-19. Mimeo (available upon request) .
  * Pesaran (2006) Pesaran, M. H. 2006.  Estimation and inference in large heterogeneous panels with a multifactor error structure.  _Econometrica_ 74(4): 967–1012.

About the authors

Jan Ditzen is an Assistant Professor at the Faculty of Economics and
Management of the Free University of Bozen-Bolzano, Italy. His research
interests are in the field of applied econometrics and spatial econometrics,
particularly cross-sectional dependence in large panels.

Yiannis Karavias is an Assistant Professor in financial economics at the
University of Birmingham. His research focuses on panel data models and their
applications in macroeconomics and finance. Methodological interests include
structural change, threshold regression, non-stationarity, and optimal
hypothesis testing.

Joakim Westerlund is a Professor at Lund University and at Deakin University.
Joakim’s primary research interest is the analysis of panel data. He has
mainly been concerned with the development of procedures for estimation and
testing of non-stationary panel data, but more recently his interest has
shifted towards the development of econometric tools for factor-augmented
regression models.