| Title: | Structural Breaks in a System of Equations |
| Version: | 1.1.0 |
| Maintainer: | Zhongjun Qu <qu@bu.edu> |
| Description: | Methods for detecting, estimating, and conducting inference on multiple structural breaks in a linear system of equations, such as multivariate linear regressions, seemingly unrelated regressions, vector autoregressions, and network vector autoregressions. Breaks can occur in the regression coefficients, the covariance matrix of the errors, or both, and can be restricted to a subset of the coefficients. The main function, sysbreak(), returns the number of breaks detected and confidence intervals for the break dates and for the regression coefficients. A separate function ordbreak() estimates ordered breaks, in which a break in one subset of equations occurs before a break in another. Specialized functions for vector autoregressions varbreak() and network vector autoregressions netbreak() are also provided. Reference: Qu, Z., and Perron, P. (2007). 'Estimating and Testing Structural Changes in Multivariate Regressions.' Econometrica, 75(2), 459-502. |
| License: | GPL (≥ 3) |
| Depends: | R (≥ 4.3.0) |
| Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
| VignetteBuilder: | knitr |
| Encoding: | UTF-8 |
| NeedsCompilation: | no |
| RoxygenNote: | 7.3.2 |
| Imports: | graphics, grDevices, MASS, stats, utils |
| Config/testthat/edition: | 3 |
| LazyData: | true |
| Packaged: | 2026-10-20 19:49:01 UTC; qu |
| Author: | Zhongjun Qu [aut, cre], Cheolju Kim [aut], Pierre Perron [aut] |
| Repository: | CRAN |
| Date/Publication: | 2026-10-31 11:40:02 UTC |
Structural Breaks in a System of Equations
Description
Estimation and testing for multivariate structural break models with coefficient breaks, covariance breaks, or both.
Main Functions
-
sysbreak: Breaks in a linear system of equations, including common-regressor and SUR-style structural break models -
varbreak: VAR structural break models -
netbreak: Network VAR structural break models -
ordbreak: Ordered two-break models -
ordcheck: Coefficient layout of an ordered two-break model -
brtype: Tests of what changes at each break -
dyspill: Generalized Diebold-Yilmaz spillover measures -
dynobreak: The same spillover measures without breaks
Break Types
The package supports the following structural break specifications:
Coefficient breaks
Covariance breaks
Joint coefficient and covariance breaks
Author(s)
Maintainer: Zhongjun Qu qu@bu.edu
Authors:
Cheolju Kim cheolju@bu.edu
Pierre Perron
References
Qu, Z., and Perron, P. (2007). Estimating and testing structural changes in multivariate regressions. Econometrica, 75(2), 459-502.
Bai, J., and Perron, P. (2003). Critical values for multiple structural change tests. The Econometrics Journal, 6(1), 72-78.
Methods to Examine What Changes at Each Break Date
Description
For each estimated break date, tests whether the volatilities, the correlations and the regression coefficients differ between the two regimes on either side of it.
Usage
brtype(fit)
Arguments
fit |
A result from |
Details
The volatility statistic is a two-sample Hotelling (1931) statistic on the squared
residuals. The correlation statistic is the Jennrich (1970) test for equal
correlation matrices, which assumes normal errors. The coefficient statistic
is a Wald test for equal coefficients; it covers only the coefficients
allowed to change, and is NA when no coefficient is allowed to change.
Each test compares the two regimes adjacent to a break and treats the break
dates as known.
The coefficient test holds the error covariance constant across regimes,
even when fit allows it to break (brv = TRUE). Estimating the
covariance separately in each regime would make the test oversized in samples of
typical length; the constant covariance tends to make it conservative when the
volatility does change.
Value
A data frame with one row per break: breaks, the break date
as a row of the data; the statistics volatility, correlation
and coefficients; and their p-values volatility_p,
correlation_p and coefficients_p. The degrees of freedom are
n, n(n-1)/2 and the number of coefficients allowed to change.
References
Hotelling, H. (1931). The generalization of Student's ratio. The Annals of Mathematical Statistics, 2(3), 360-378.
Jennrich, R. I. (1970). An asymptotic chi-square test for the equality of two correlation matrices. Journal of the American Statistical Association, 65, 904-912.
Examples
set.seed(11)
bigt <- 120
x <- rnorm(bigt)
y1 <- 1 + 0.4 * x + rnorm(bigt, sd = 0.3)
y2 <- -0.5 + 0.2 * x + rnorm(bigt, sd = 0.3)
y1[61:120] <- y1[61:120] + 1.2 - 0.6 * x[61:120]
dat <- data.frame(y1 = y1, y2 = y2, x = x)
fit <- sysbreak(cbind(y1, y2) ~ x, data = dat, m = 2, trim = 0.2)
brtype(fit)
GAUSS/MATLAB Example Data 1
Description
Example data used by the original GAUSS/MATLAB mbreak2 script. In this
package the corresponding procedure is sysbreak.
Usage
data1
Format
A numeric matrix with 150 rows and 5 columns. Columns 1 and 2 are dependent variables, and columns 3 through 5 are regressors.
Source
Qu, Z., and Perron, P. (2007). Estimating and testing structural changes in multivariate regressions. Econometrica, 75(2), 459-502.
GAUSS/MATLAB Example Data 2
Description
Example data used by the original GAUSS/MATLAB obreak2 script for the
ordered-break procedure.
Usage
data2
Format
A numeric matrix with 100 rows and 5 columns. Columns 1 and 2 are dependent variables, and columns 3 through 5 are regressors.
Source
Qu, Z., and Perron, P. (2007). Estimating and testing structural changes in multivariate regressions. Econometrica, 75(2), 459-502.
Diebold-Yilmaz Spillover Measures Without Breaks
Description
Fits a VAR by OLS on the whole sample and computes the generalized
spillover measures of dyspill(), for comparison with the measures
of a model with breaks.
Usage
dynobreak(y, lags, h, intercept = TRUE)
Arguments
y |
Numeric matrix, one column per variable. |
lags |
Positive integer number of lags. |
h |
Positive integer forecast horizon. |
intercept |
Logical; include an intercept. |
Value
A list with the row-normalized generalized fevd, the total
spillover index total, and the directional vectors from,
to and net. The covariance divides by the number of
observations.
Examples
set.seed(1)
bigt <- 120
a <- matrix(c(0.2, 0.4, 0.4, 0.2), 2)
y <- matrix(0, bigt, 2)
colnames(y) <- c("y1", "y2")
for (tt in 2:bigt) {
y[tt, ] <- a %*% y[tt - 1, ] + rnorm(2, sd = 0.3)
}
sp <- dynobreak(y, lags = 1, h = 10)
sp$total
sp$net
Diebold-Yilmaz Generalized Spillover Measures
Description
Computes horizon-specific spillover measures from a fitted structural-break VAR model. The forecast-error variance decomposition uses generalized shocks and is therefore invariant to variable ordering.
Usage
dyspill(fit, h = 10, boot = 0, seed = NULL)
Arguments
fit |
A fitted object returned by |
h |
Positive integer for forecast horizon. |
boot |
Number of bootstrap replications for standard errors and
confidence intervals; |
seed |
Optional seed for the bootstrapping. The seed of the calling session is restored on exit. |
Details
For a regime-specific VAR,
y_t = c_r + \sum_{\ell=1}^p A_{\ell,r}y_{t-\ell}+u_t,\qquad
E(u_tu_t')=\Sigma_r,
let \Psi_{0,r}=I and
\Psi_{s,r}=\sum_{\ell=1}^{\min(p,s)}
A_{\ell,r}\Psi_{s-\ell,r}.
The generalized variance share from shock j to variable i is
\theta_{ij}^{g}(H)=
\frac{\sigma_{jj}^{-1}\sum_{s=0}^{H-1}
(e_i'\Psi_s\Sigma e_j)^2}
{\sum_{s=0}^{H-1}e_i'\Psi_s\Sigma\Psi_s'e_i}.
Rows are normalized to sum to one before spillover statistics are formed.
For variable i, from is the contribution received from all
other shocks, to is the contribution transmitted to all other
variables, and net = to - from; a positive net value identifies a
net transmitter. The total spillover index is the average off-diagonal
contribution, expressed in percent.
The benchmark puts every lag matrix to zero and keeps \Sigma_r. The
measures then depend on the error correlations only; comparing them with
the fitted ones shows how much of the spillover comes from the dynamics.
With two variables the benchmark total is
100\rho^2/(1+\rho^2).
The bootstrap is a recursive residual bootstrap within each regime: the
residuals of the regime are resampled, the series is rebuilt from the
fitted VAR of the regime, the model is refitted at the same break dates in
the same way as fit, and the measures are recomputed. The break dates
are treated as known. The intervals are percentile intervals, since the
draws are skewed in small samples. Draws in which a refitted VAR is not
stable are dropped.
Value
An object of class "dyspill" containing:
horizonThe forecast horizon
h.modelThe source model type.
variablesNames of the endogenous variables.
break_gridA data frame with one row per regime: the
regimenumber; its first and last observation,startandend, counted in the estimation sample (which omits the firstlagsobservations); and the coefficient and covariance regimes it belongs to,coef_regimeandcov_regime.regimesA list with one entry per regime. Each entry contains:
-
input_rows: the first and last row of the data in the regime. -
spectral_radius: the largest modulus of the eigenvalues of the companion matrix of the VAR; the VAR is stable when it is below one. -
fevd: the generalized forecast-error variance decomposition, with rows normalized to sum to one. -
total: the total spillover index. -
from,toandnet: the directional spillovers of each variable. -
net_pairwise: the matrix of net pairwise spillovers. -
benchmark_totalandbenchmark_net:totalandnetrecomputed with all lag coefficients set to zero, so that they reflect the error correlations only (see Details). With
boot > 0: the bootstrap standard errorstotal_seandnet_se, and the percentile intervalstotal_ciandnet_ci.
-
bootReturned only when
boot > 0. A list with:-
replications: the number of bootstrap replications. -
level: the coverage probability of the intervals, taken fromci_levelof the fit. -
total: the bootstrap draws of the total index, a matrix with one row per replication and one column per regime. -
net: the bootstrap draws of the net spillovers, an array of replications by variables by regimes. -
differences: a data frame with one row per pair of regimes, giving thedifferencein the total index (the later regime minus the earlier one), its bootstrap standard errorse, and the percentile intervallowerandupper. -
dropped: the number of draws dropped in each regime because the refitted VAR was not stable.
-
References
Diebold, F. X., and Yilmaz, K. (2012). Better to give than to receive: Predictive directional measurement of volatility spillovers. International Journal of Forecasting, 28(1), 57–66.
Examples
set.seed(1)
bigt <- 120
y <- matrix(0, bigt, 2)
colnames(y) <- c("y1", "y2")
for (tt in 2:bigt) {
a <- if (tt > 60) matrix(c(0.2, 0.6, 0.6, 0.2), 2) else diag(0.2, 2)
y[tt, ] <- a %*% y[tt - 1, ] + rnorm(2, sd = 0.3)
}
fit <- varbreak(y, lags = 1, m = 1, trim = 0.2)
dyspill(fit, h = 10, boot = 99, seed = 1)
U.S. House Prices and the Macroeconomy
Description
Quarterly data for the house price application of Ahamada and Diaz Sanchez (2013), 1959:Q4 to 2009:Q3.
Usage
housing
Format
A data frame with 200 rows and 6 columns:
- date
Quarter, such as
"1960:Q1".- dGDP
Log difference of real GDP.
- dC
Log difference of real personal consumption expenditures.
- dHP
Log difference of the real home price index.
- FFR
Federal funds rate, in percent, first month of the quarter.
- dI
Change in
FFR.
Source
FRED series GDPC1, PCEC, CPIAUCSL and FEDFUNDS, and the Shiller nominal home price index, seasonally adjusted by log-STL. Consumption and home prices are deflated by CPIAUCSL.
References
Ahamada, I., and Diaz Sanchez, J. L. (2013). A retrospective analysis of the house price macro-relationship in the United States. International Journal of Central Banking, 9(4), 153-174.
International Inflation
Description
Monthly consumer price inflation for the G7 countries and the euro area, 1973:04 to 2007:12, from Bataa, Osborn, Sensier and van Dijk (2013).
Usage
inflation
Format
A data frame with 417 rows and 9 columns: date, such as
"1973:04", followed by inflation for Canada,
EuroArea, France, Germany, Italy,
Japan, UK and US. Inflation is
100 \times \Delta \log of the consumer price index, adjusted for
outliers and seasonality by the authors.
Source
The replication files of Bataa et al. (2013).
References
Bataa, E., Osborn, D. R., Sensier, M., and van Dijk, D. (2013). Structural breaks in the international dynamics of inflation. Review of Economics and Statistics, 95(2), 646-659.
Structural Breaks in a network VAR
Description
Estimates structural breaks in a VAR whose coefficients are restricted by a fixed network matrix. With one lag, the model is
y_t = \mu_j + (\alpha_{1,j} W + \beta_{1,j} I)y_{t-1} + u_t,
for observations in regime j. With multiple lags, the model is
y_t = \mu_j + \sum_{\ell=1}^p
(\alpha_{\ell,j} W + \beta_{\ell,j} I)y_{t-\ell} + u_t.
Usage
netbreak(y, W, lags, m, intercept = TRUE,
coef_breaks = "all", row_normalize = FALSE,
test_level = 0.05, ci_level = 0.95,
trim = 0.15, verbose = FALSE, brv = FALSE,
robust = c("none", "hc", "hac"), hetq = FALSE, prewhit = FALSE,
restart = c("none", "brbp", "brbp_residual"),
restart_B = 10, restart_verbose = FALSE, h = NULL)
Arguments
y |
Numeric matrix/data frame with one column per network node. |
W |
Numeric square network matrix. Row |
lags |
Positive integer, number of lags. |
m |
The maximum number of breaks allowed. |
intercept |
Logical. If |
coef_breaks |
Parameters allowed to change across regimes. The
parameters are one intercept per node,
Entries are case-insensitive and may be combined, as in
|
row_normalize |
Logical. If |
test_level |
Significance level used for selecting the number of breaks.
One of |
ci_level |
Coverage probability of the reported confidence intervals
for the break dates. Either |
trim |
Trimming parameter. The minimum segment length is
|
verbose |
Logical. If |
brv |
Logical. If |
robust |
Inference for the coefficient-break tests, the coefficient
standard errors and the break-date confidence intervals. |
hetq |
Logical. If |
prewhit |
Logical. If |
restart |
A bootstrap restarting procedure to check and improve
convergence. It applies only when some coefficients are held constant;
otherwise it is ignored with a warning. Set to
|
restart_B |
Integer, number of restart values used when
|
restart_verbose |
Logical. If |
h |
Optional positive integer for forecast horizon. If supplied,
attach Diebold–Yilmaz generalized spillover measures in |
Details
The interpretation of testing$statistic depends on robust.
-
robust = "none"gives the SupLR statistic. The code can test the parameters specified bycoef_breaks, the disturbance covariance whenbrv = TRUE, or both. -
robust = "hc"or"hac"gives the robust SupF statistic, for the parameters only, because the covariance-break critical values are case dependent under heteroskedasticity or serial correlation; it assumes a constant error covariance. Withbrv = TRUE, the estimates, standard errors and confidence intervals account for the covariance breaks; under"hc"the intervals further require errors without ARCH-type dependence.
Value
An object of class c("netbreak", "sysbreak") containing:
specA summary of the setup, including the sample size
bigt, the number of equationsn, the total number of NVAR parameters per regimeq, the argumentsm,lags,intercept,row_normalize,trim,brv,robust,hetq,prewhit,test_levelandci_level, the network matrixW, the equation and parameter names, the retained input rowsy_rowsafter discarding the lags, and a record of thecoef_breaksselector.testingThe tests, reported at
test_level:statistic, testing no break againstkbreaks for everyk = 1,\ldots,m, with itscritical_values;statistic_type,"SupLR"or"SupF", andNAwhen a requested robust test is unavailable;wdmaxandwdmax_critical_values; thesequentialtests oflagainstl+1breaks, each containingl, astatisticand itscritical_values; and the number ofchanging_parameters, which includes the changing covariance parameters whenrobust = "none".br_selectedThe outcome of the break-number determination at
test_level: the selected number ofbreaks, the WDmax statistic with its critical value and significance flag, and thesequentialsteps taken.breaksis0when WDmax is not significant, andNAwhen the tests are unavailable for the requested specification.estimationThe estimates related to the selected number of breaks: estimated
breaks; their confidence intervalsci_breaks;coefficientsby regimes and their confidence intervals; disturbancecovariancematrices. This component isNULLwhen no break is detected, in which case onlytestingandbr_selectedare informative.spilloverWhen
his supplied and at least one break is selected, regime-specific Diebold–Yilmaz generalized spillover measures returned bydyspill.yThe responses used in estimation, rows
spec$y_rowsofy.
Note that m is the maximum number of breaks allowed. Testing
output is reported for every value from 1 through m, while
estimation corresponds to the number of breaks selected by the
procedure under test_level. Parameters excluded by
coef_breaks are repeated across regime blocks. The optional
spillover component is omitted when h = NULL. The fit has
print(), summary(),
plot() and the accessors in
sysbreak-methods.
References
Andrews, D. W. K. (1991). Heteroskedasticity and autocorrelation consistent covariance matrix estimation. Econometrica, 59(3), 817–858.
Andrews, D. W. K., and Monahan, J. C. (1992). An improved heteroskedasticity and autocorrelation consistent covariance matrix estimator. Econometrica, 60(4), 953–966.
Zhu, X., Pan, R., Li, G., Liu, Y., and Wang, H. (2017). Network vector autoregression. The Annals of Statistics, 45(3), 1096–1123.
Qu, Z., and Perron, P. (2007). Estimating and testing structural changes in multivariate regressions. Econometrica, 75(2), 459–502.
Examples
set.seed(5)
bigt <- 80
W <- matrix(c(0, 1, 1, 0), 2, 2, byrow = TRUE)
y <- matrix(0, bigt, 2)
colnames(y) <- c("y1", "y2")
for (tt in 2:bigt) {
alpha <- if (tt <= 40) 0.05 else 0.75
beta <- 0.1
y[tt, ] <- alpha * as.numeric(W %*% y[tt - 1, ]) +
beta * y[tt - 1, ] + rnorm(2, sd = 0.2)
}
fit <- netbreak(
y = y, W = W, lags = 1, m = 1,
coef_breaks = c("network", "own"),
trim = 0.2
)
fit$estimation$breaks
Simulated Network VAR
Description
One draw from Scenario 1 of Han and Lee (2024): a network VAR for 20 nodes over 300 periods, with breaks after periods 100 and 200.
Usage
netsim
Format
A list with two components:
- y
A 300 by 20 matrix of observations, with columns
node1tonode20.- W
The 20 by 20 row-normalized network matrix. Entry
(i, l)is1/n_iif nodeifollows nodeland 0 otherwise, wheren_iis the number of nodes thatifollows.
Details
In regime j,
y_{it} = V_i'\gamma_j + \sum_{\ell} \alpha_{\ell,j} (W y_{t-\ell})_i +
\sum_{\ell} \beta_{\ell,j} y_{i,t-\ell} + e_{it}, \qquad
e_{it} \sim N(0, 0.1^2).
Regime 1 has one lag, with \alpha = -0.10 and \beta = 0.20.
Regimes 2 and 3 have two lags, with \alpha = (0.20, -0.22),
\beta = (-0.12, 0.40) and \alpha = (-0.12, 0.10),
\beta = (0.25, -0.40). The covariates V_i are fixed, so
V_i'\gamma_j is a node intercept that changes across regimes. The
in-degrees of the network follow a power law, as in Zhu et al. (2017).
Source
Simulated with set.seed(1) following Han and Lee (2024).
References
Han, Y., and Lee, T. C. M. (2024). Structural break detection in non-stationary network vector autoregression models. IEEE Transactions on Network Science and Engineering, 11(5), 4134-4145.
Zhu, X., Pan, R., Li, G., Liu, Y., and Wang, H. (2017). Network vector autoregression. The Annals of Statistics, 45(3), 1096-1123.
Ordered Structural Breaks in a System of Equations
Description
Estimation of a multiple-equation system in which the coefficients of one group of equations change before those of another group. The two break dates are estimated jointly and are not restricted to coincide.
Usage
ordbreak(set1, set2, data,
coef_breaks1 = "all", coef_breaks2 = "all",
trim = 0.2, hetq = TRUE, max_break_gap = NULL,
test_level = 0.05, ci_level = 0.95,
confidence_intervals = FALSE,
ci_grid_radius = 20, ci_replications = 5000, ci_step = 1000,
ci_grid_step = 0.02, ci_seed = NULL, ci_verbose = FALSE,
tol = 1e-8, max_iter = 1000)
Arguments
set1 |
The equations whose coefficients change at the first date. A
formula such as |
set2 |
The equations whose coefficients change at the second date,
written in the same way as |
data |
Data frame used to evaluate the formulas. |
coef_breaks1 |
An expression for which coefficients of
Coefficients left out are held constant across both dates. At least one
coefficient of |
coef_breaks2 |
The same, for |
trim |
Trimming parameter, which must lie in |
hetq |
Logical. If |
max_break_gap |
Truncation used when computing the test statistic. If
|
test_level |
Significance level at which the critical value is
reported. One of |
ci_level |
Coverage probability of the reported confidence intervals
for the break dates. Either |
confidence_intervals |
Logical. If |
ci_grid_radius |
Half-width of the grid on which the limiting distribution is simulated. |
ci_replications |
Number of simulation replications. |
ci_step |
Number of steps used to discretize each Brownian motion. |
ci_grid_step |
Spacing of the simulation grid. |
ci_seed |
Optional seed for the simulation. The seed of the calling session is restored on exit. |
ci_verbose |
Logical. If |
tol |
Convergence tolerance of the feasible GLS iterations. |
max_iter |
Maximum number of feasible GLS iterations. |
Details
The coefficients are stacked equation by equation in the order the formulas
are given, so those of set1 occupy the leading q1 positions and
those of set2 the remaining q2. ordcheck reports
this layout without estimating anything, which is worth doing before a long
run.
The test is that of Qu and Perron (2007, Section 6.4) for locally ordered breaks. The test for globally ordered breaks in their Section 6.5, whose limiting distribution differs, is not implemented.
Value
An object of class "ordbreak" containing:
specThe setup: the sample size
bigt, the number of equationsn, the minimum segment lengthh, the number of coefficients in each setq1andq2, the number of equations in the first setn1, the names of the coefficients allowed to change at each date,changing1andchanging2, the argumentstrim,hetqandtrun, the input formulas split intoset1andset2, the equation and coefficient names, the retained data rowsy_rowsafter discarding missing values, and the selection matrixS.testingThe SupLR statistic for ordered breaks,
sup_lr_ordered, itscritical_valuesattest_level, the pairtruncated_breaksthe statistic is computed at, and the log-likelihoodsH1likeandH0likeit is built from. The critical value is indexed by the number of coefficients allowed to change, not by the total number of coefficients.estimationThe estimated
breaks, given as rows ofdata; the coefficientsbeta1andbeta2of the two regimes; theresidualsof the model at the estimated breaks, one column per equation; and the coefficient shiftsdelta1anddelta2occurring at the two dates; andci_breaks, a two by two matrix whenconfidence_intervals = TRUEandNULLotherwise, also given as rows ofdata. Its rows are the two break dates and its columns the lower and upper bounds atci_level.
Note that the ordering is imposed rather than tested. The equations in
set1 are taken to break first, so exchanging the two sets specifies a
different model. Both specifications are tested against the same no-break
null, and their values of sup_lr_ordered can be compared.
References
Qu, Z., and Perron, P. (2007). Estimating and testing structural changes in multivariate regressions. Econometrica, 75(2), 459–502.
Examples
set.seed(13)
bigt <- 60
x1 <- rnorm(bigt)
x2 <- rnorm(bigt)
y1 <- 1 + 0.5 * x1 + rnorm(bigt, sd = 0.3)
y2 <- 1 + 0.5 * x2 + rnorm(bigt, sd = 0.3)
y1[21:bigt] <- y1[21:bigt] + 1.5 * x1[21:bigt]
y2[36:bigt] <- y2[36:bigt] - 1.5 * x2[36:bigt]
dat <- data.frame(y1 = y1, y2 = y2, x1 = x1, x2 = x2)
fit <- ordbreak(y1 ~ x1, y2 ~ x2, data = dat, trim = 0.2)
fit$estimation$breaks
Coefficient Layout of an Ordered-Break Specification
Description
Reports the coefficients of an ordered-break model, which set of equations they belongs to, and which of them are allowed to change, without estimating anything.
Usage
ordcheck(set1, set2, data, coef_breaks1 = "all", coef_breaks2 = "all")
Arguments
set1 |
The equations whose coefficients change at the first date,
written as in |
set2 |
The equations whose coefficients change at the second date. |
data |
Data frame used to evaluate the formulas. |
coef_breaks1 |
Which coefficients of |
coef_breaks2 |
The same, for |
Value
The layout is printed: one row per coefficient, giving its position in the coefficient vector, its name, the set it belongs to, whether it is allowed to change, and the date at which it changes.
Examples
set.seed(13)
dat <- data.frame(y1 = rnorm(40), y2 = rnorm(40),
x1 = rnorm(40), x2 = rnorm(40))
ordcheck(y1 ~ x1 + x2, y2 ~ x1 + x2, data = dat,
coef_breaks1 = list(y1 ~ x1))
Plot a Structural-Break Fit
Description
Plots each series with the estimated break dates (dashed lines), their confidence intervals (shaded) and, optionally, the fitted values of the regime-specific model.
Usage
## S3 method for class 'sysbreak'
plot(x, which = NULL, dates = NULL, fitted = TRUE, ...)
Arguments
x |
|
which |
Series to plot, as indices or names. By default all series, or the first four when there are more. |
dates |
Optional vector with one entry per row of the data passed to
the fitting function, including the initial lags of a VAR and any rows
dropped for missing values; the observation in row |
fitted |
Logical. If |
... |
Graphical parameters. |
Value
x, invisibly.
See Also
sysbreak-methods, summary.sysbreak
Examples
set.seed(11)
bigt <- 40
x <- rnorm(bigt)
y1 <- 1 + 0.4 * x + rnorm(bigt, sd = 0.3)
y2 <- -0.5 + 0.2 * x + rnorm(bigt, sd = 0.3)
y1[21:40] <- y1[21:40] + 1.2 - 0.6 * x[21:40]
y2[21:40] <- y2[21:40] - 0.8 + 0.4 * x[21:40]
dat <- data.frame(y1 = y1, y2 = y2, x = x)
fit <- sysbreak(cbind(y1, y2) ~ x, dat, m = 1, trim = 0.3)
plot(fit)
Summarize a Structural-Break Fit
Description
A report of a fit returned by sysbreak,
varbreak or netbreak: the break number,
the break dates with their confidence intervals, and a coefficient table for
each regime. print() of the fit gives the full output.
Usage
## S3 method for class 'sysbreak'
summary(object, ...)
## S3 method for class 'summary.sysbreak'
print(x, digits = max(3L, getOption("digits") - 3L), ...)
Arguments
object |
A fit returned by |
... |
Not used. |
x |
An object returned by |
digits |
Number of significant digits in the coefficient tables. |
Value
An object of class "summary.sysbreak", a list with the
model type, the numbers of equations n and observations
bigt, the tests for the break-number decision, the number
of breaks selected, and, when at least one break is selected, the
break dates with their confidence intervals (breaks), the rows of
the data in each regime (regimes) and the coefficient tables
(coefficients): estimate, standard error, z value and
two-sided p-value, one table per regime, treating the break dates as
known.
See Also
sysbreak-methods, plot.sysbreak
Examples
set.seed(11)
bigt <- 40
x <- rnorm(bigt)
y1 <- 1 + 0.4 * x + rnorm(bigt, sd = 0.3)
y2 <- -0.5 + 0.2 * x + rnorm(bigt, sd = 0.3)
y1[21:40] <- y1[21:40] + 1.2 - 0.6 * x[21:40]
y2[21:40] <- y2[21:40] - 0.8 + 0.4 * x[21:40]
dat <- data.frame(y1 = y1, y2 = y2, x = x)
fit <- sysbreak(cbind(y1, y2) ~ x, dat, m = 1, trim = 0.3)
summary(fit)
Structural Breaks in a System of Equations
Description
Estimation of a multiple-equation system affected by structural breaks in the regression coefficients and/or the variance covariance matrix of the residuals.
Usage
sysbreak(model, data = NULL, m, coef_breaks = "all",
test_level = 0.05, ci_level = 0.95,
trim = 0.15, verbose = FALSE, brv = FALSE,
robust = c("none", "hc", "hac"), hetq = FALSE, prewhit = FALSE,
restart = c("none", "brbp", "brbp_residual"),
restart_B = 10, restart_verbose = FALSE)
Arguments
model |
A formula such as |
data |
Data frame used to evaluate |
m |
Integer, the maximum number of breaks allowed when testing for breaks. |
coef_breaks |
An expression for which regression coefficients are
allowed to change across regimes. The default
|
test_level |
Significance level used to select the number of breaks.
One of |
ci_level |
Coverage probability of the reported confidence intervals
for the break dates. Either |
trim |
Trimming parameter. The minimum segment length is
|
verbose |
Logical. If |
brv |
Logical. If |
robust |
Inference for the coefficient-break tests, the coefficient
standard errors and the break-date confidence intervals. |
hetq |
Logical. If |
prewhit |
Logical. If |
restart |
A bootstrap restarting procedure to check and improve
convergence. It applies only when some coefficients are held constant;
otherwise it is ignored with a warning. Set to
|
restart_B |
Number of restarting values used when
|
restart_verbose |
Logical. If |
Details
The interpretation of testing$statistic depends on robust.
-
robust = "none"gives the SupLR statistic. The code can test the coefficients specified bycoef_breaks, the disturbance covariance whenbrv = TRUE, or both. -
robust = "hc"or"hac"gives the robust SupF statistic, for the coefficients only, because the covariance-break critical values are case dependent under heteroskedasticity or serial correlation; it assumes a constant error covariance. Withbrv = TRUE, the estimates, standard errors and confidence intervals account for the covariance breaks; under"hc"the intervals further require errors without ARCH-type dependence.
Value
An object of class "sysbreak" containing:
specA summary of the setup, including the sample size
bigt, the number of equationsn, the total number of regression coefficients per regimeq, the argumentsm,trim,brv,robust,hetq,prewhit,test_levelandci_level, the input formula or formulas, the equation and coefficient names, the retained data rowsy_rowsafter discarding missing values, and a record of thecoef_breaksselector.testingThe tests, reported at
test_level:statistic, testing no break againstkbreaks for everyk = 1,\ldots,m, with itscritical_values;statistic_type,"SupLR"or"SupF", andNAwhen a requested robust test is unavailable;wdmaxandwdmax_critical_values; thesequentialtests oflagainstl+1breaks, each containingl, astatisticand itscritical_values; and the number ofchanging_parameters, which includes the changing covariance parameters whenrobust = "none".br_selectedThe outcome of the break-number determination at
test_level: the selected number ofbreaks, the WDmax statistic with its critical value and significance flag, and thesequentialsteps taken.breaksis0when WDmax is not significant, andNAwhen the tests are unavailable for the requested specification.estimationThe estimates related to the selected number of breaks: estimated
breaks; their confidence intervalsci_breaks;coefficientsby regimes and their confidence intervals; disturbancecovariancematrices. This component isNULLwhen no break is detected, in which case onlytestingandbr_selectedare informative.yThe responses used in estimation, rows
spec$y_rowsofdata.
Note that m is the maximum number of breaks allowed. Testing
output is reported for every value from 1 through m, while
estimation corresponds to the number of breaks selected by the
procedure under test_level. The fit has print(),
summary(),
plot() and the accessors in
sysbreak-methods.
References
Andrews, D. W. K. (1991). Heteroskedasticity and autocorrelation consistent covariance matrix estimation. Econometrica, 59(3), 817–858.
Andrews, D. W. K., and Monahan, J. C. (1992). An improved heteroskedasticity and autocorrelation consistent covariance matrix estimator. Econometrica, 60(4), 953–966.
Bai, J., and Perron, P. (1998). Estimating and testing linear models with multiple structural changes. Econometrica, 66(1), 47–78.
Qu, Z., and Perron, P. (2007). Estimating and testing structural changes in multivariate regressions. Econometrica, 75(2), 459–502.
Examples
set.seed(11)
bigt <- 40
x <- rnorm(bigt)
y1 <- 1 + 0.4 * x + rnorm(bigt, sd = 0.3)
y2 <- -0.5 + 0.2 * x + rnorm(bigt, sd = 0.3)
y1[21:40] <- y1[21:40] + 1.2 - 0.6 * x[21:40]
y2[21:40] <- y2[21:40] - 0.8 + 0.4 * x[21:40]
dat <- data.frame(y1 = y1, y2 = y2, x = x)
fit <- sysbreak(cbind(y1, y2) ~ x, data = dat, m = 1, trim = 0.2)
fit$estimation$breaks
Methods for Displaying Structural-Break Fits
Description
Fits returned by sysbreak,
varbreak and netbreak. All refer to the
estimates at the selected number of breaks.
Usage
## S3 method for class 'sysbreak'
coef(object, ...)
## S3 method for class 'sysbreak'
vcov(object, ...)
## S3 method for class 'sysbreak'
confint(object, parm, level = NULL, type = c("breaks", "coef"), ...)
## S3 method for class 'sysbreak'
residuals(object, ...)
## S3 method for class 'sysbreak'
fitted(object, ...)
## S3 method for class 'sysbreak'
nobs(object, ...)
Arguments
object |
A fit returned by |
... |
Not used. |
parm |
Breaks ( |
level |
Coverage probability. By default the |
type |
|
Value
coefA named vector of the regime coefficients: all coefficients of regime 1, then those of regime 2, and so on. Each name joins the regime and the coefficient label used by
summary(), as in"regime1:y1:x"(equationy1, regressorx) or"regime2:mu:node3"fornetbreak. Coefficients held constant bycoef_breaksare repeated in every regime.vcovThe covariance matrix of
coef(), with rows and columns in the same order and with the same names. Whencoef_breaksholds coefficients constant, the matrix is singular, since the repeated entries of a constant coefficient are perfectly correlated.confintFor
type = "breaks", a matrix with one row per break: the lower bound, the estimated break date and the upper bound. Fortype = "coef", the lower and upper bounds of confidence intervals, estimate\pmnormal quantile times standard error, treating the break dates as known.residuals,fittedMatrices with one column per equation and one row per observation; the row names are the rows of the data (
spec$y_rows).nobsThe number of observations used.
When no break is selected the regime estimates are not computed, and all
but nobs stop with an error.
See Also
summary.sysbreak, plot.sysbreak
Examples
set.seed(11)
bigt <- 40
x <- rnorm(bigt)
y1 <- 1 + 0.4 * x + rnorm(bigt, sd = 0.3)
y2 <- -0.5 + 0.2 * x + rnorm(bigt, sd = 0.3)
y1[21:40] <- y1[21:40] + 1.2 - 0.6 * x[21:40]
y2[21:40] <- y2[21:40] - 0.8 + 0.4 * x[21:40]
dat <- data.frame(y1 = y1, y2 = y2, x = x)
fit <- sysbreak(cbind(y1, y2) ~ x, dat, m = 1, trim = 0.3)
coef(fit)
confint(fit)
confint(fit, level = 0.90)
confint(fit, type = "coef")
head(residuals(fit))
nobs(fit)
Structural Breaks in a VAR
Description
Estimation of a VAR affected by structural breaks in the regression coefficients and/or the variance covariance matrix of the residuals.
Usage
varbreak(y, lags, m, intercept = TRUE, coef_breaks = "all",
test_level = 0.05, ci_level = 0.95,
trim = 0.15, verbose = FALSE, brv = FALSE,
robust = c("none", "hc", "hac"), hetq = FALSE, prewhit = FALSE,
restart = c("none", "brbp", "brbp_residual"),
restart_B = 10, restart_verbose = FALSE, h = NULL)
Arguments
y |
Numeric response matrix with one column per variable. |
lags |
Positive integer, number of lags. |
m |
Integer, maximum number of breaks allowed. |
intercept |
Logical. If |
coef_breaks |
Coefficient-break selector, applied after the VAR lag
matrix is built. The default |
test_level |
Significance level used for selecting the number of breaks.
One of |
ci_level |
Coverage probability of the reported confidence intervals
for the break dates. Either |
trim |
Trimming parameter. The minimum segment length is
|
verbose |
Logical. If |
brv |
Logical. If |
robust |
Inference for the coefficient-break tests, the coefficient
standard errors and the break-date confidence intervals. |
hetq |
Logical. If |
prewhit |
Logical. If |
restart |
A bootstrap restarting procedure to check and improve
convergence. It applies only when some coefficients are held constant;
otherwise it is ignored with a warning. Set to
|
restart_B |
Integer, number of restart values used when
|
restart_verbose |
Logical. If |
h |
Optional positive integer for forecast horizon. If supplied,
attach Diebold–Yilmaz generalized spillover measures in |
Details
The interpretation of testing$statistic depends on robust.
-
robust = "none"gives the SupLR statistic. The code can test the coefficients specified bycoef_breaks, the disturbance covariance whenbrv = TRUE, or both. -
robust = "hc"or"hac"gives the robust SupF statistic, for the coefficients only, because the covariance-break critical values are case dependent under heteroskedasticity or serial correlation; it assumes a constant error covariance. Withbrv = TRUE, the estimates, standard errors and confidence intervals account for the covariance breaks; under"hc"the intervals further require errors without ARCH-type dependence.
Value
An object of class c("varbreak", "sysbreak") containing:
specA summary of the setup, including the sample size
bigt, the number of equationsn, the total number of coefficients per regimeq, the argumentsm,lags,intercept,trim,brv,robust,hetq,prewhit,test_levelandci_level, the equation and coefficient names, the retained input rowsy_rowsafter discarding the lags, and thecoef_breaksselector.testingThe tests, reported at
test_level:statistic, testing no break againstkbreaks for everyk = 1,\ldots,m, with itscritical_values;statistic_type,"SupLR"or"SupF", andNAwhen a requested robust test is unavailable;wdmaxandwdmax_critical_values; thesequentialtests oflagainstl+1breaks, each containingl, astatisticand itscritical_values; and the number ofchanging_parameters, which includes the changing covariance parameters whenrobust = "none".br_selectedThe outcome of the break-number determination at
test_level: the selected number ofbreaks, the WDmax statistic with its critical value and significance flag, and thesequentialsteps taken.breaksis0when WDmax is not significant, andNAwhen the tests are unavailable for the requested specification.estimationThe estimates related to the selected number of breaks: estimated
breaks; their confidence intervalsci_breaks;coefficientsby regimes and their confidence intervals; disturbancecovariancematrices. This component isNULLwhen no break is detected, in which case onlytestingandbr_selectedare informative.spilloverWhen
his supplied and at least one break is selected, regime-specific Diebold–Yilmaz generalized spillover measures returned bydyspill.yThe responses used in estimation, rows
spec$y_rowsofy.
Note that m is the maximum number of breaks allowed. Testing
output is reported for every value from 1 through m, while
estimation corresponds to the number of breaks selected by the
procedure under test_level. The optional spillover component
is omitted when h = NULL. The fit has print(),
summary(),
plot() and the accessors in
sysbreak-methods.
References
Andrews, D. W. K. (1991). Heteroskedasticity and autocorrelation consistent covariance matrix estimation. Econometrica, 59(3), 817–858.
Andrews, D. W. K., and Monahan, J. C. (1992). An improved heteroskedasticity and autocorrelation consistent covariance matrix estimator. Econometrica, 60(4), 953–966.
Bai, J., and Perron, P. (1998). Estimating and testing linear models with multiple structural changes. Econometrica, 66(1), 47–78.
Qu, Z., and Perron, P. (2007). Estimating and testing structural changes in multivariate regressions. Econometrica, 75(2), 459–502.
Examples
set.seed(12)
bigt <- 45
y <- matrix(0, bigt, 2)
for (tt in 2:bigt) {
shift <- if (tt > 24) c(0.8, -0.6) else c(0, 0)
y[tt, ] <- shift +
c(0.3 * y[tt - 1, 1], -0.2 * y[tt - 1, 2]) +
rnorm(2, sd = 0.3)
}
fit <- varbreak(y, lags = 1, m = 1, trim = 0.2)
fit$estimation$breaks