| Title: | Structural Breaks in a System of Equations |
|---|---|
| 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. |
| Authors: | Zhongjun Qu [aut, cre], Cheolju Kim [aut], Pierre Perron [aut] |
| Maintainer: | Zhongjun Qu <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.1.0 |
| Built: | 2026-10-31 18:58:55 UTC |
| Source: | https://github.com/cran/sysbreak |
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.
brtype(fit)brtype(fit)
fit |
A result from |
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.
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
, and the number of coefficients allowed to change.
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.
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)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)
Example data used by the original GAUSS/MATLAB mbreak2 script. In this
package the corresponding procedure is sysbreak.
data1data1
A numeric matrix with 150 rows and 5 columns. Columns 1 and 2 are dependent variables, and columns 3 through 5 are regressors.
Qu, Z., and Perron, P. (2007). Estimating and testing structural changes in multivariate regressions. Econometrica, 75(2), 459-502.
Example data used by the original GAUSS/MATLAB obreak2 script for the
ordered-break procedure.
data2data2
A numeric matrix with 100 rows and 5 columns. Columns 1 and 2 are dependent variables, and columns 3 through 5 are regressors.
Qu, Z., and Perron, P. (2007). Estimating and testing structural changes in multivariate regressions. Econometrica, 75(2), 459-502.
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.
dynobreak(y, lags, h, intercept = TRUE)dynobreak(y, lags, h, intercept = TRUE)
y |
Numeric matrix, one column per variable. |
lags |
Positive integer number of lags. |
h |
Positive integer forecast horizon. |
intercept |
Logical; include an intercept. |
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.
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$netset.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
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.
dyspill(fit, h = 10, boot = 0, seed = NULL)dyspill(fit, h = 10, boot = 0, seed = NULL)
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. |
For a regime-specific VAR,
let and
The generalized variance share from shock to variable is
Rows are normalized to sum to one before spillover statistics are formed.
For variable , 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 . 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
.
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.
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
regime number; its first and last observation, start and
end, counted in the estimation sample (which omits the first
lags observations); and the coefficient and covariance regimes
it belongs to, coef_regime and cov_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, to and net: the directional
spillovers of each variable.
net_pairwise: the matrix of net pairwise spillovers.
benchmark_total and benchmark_net: total
and net recomputed with all lag coefficients set to zero, so
that they reflect the error correlations only (see Details).
With boot > 0: the bootstrap standard errors
total_se and net_se, and the percentile intervals
total_ci and net_ci.
bootReturned only when boot > 0. A list with:
replications: the number of bootstrap replications.
level: the coverage probability of the intervals, taken
from ci_level of 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 the difference in the total index (the later
regime minus the earlier one), its bootstrap standard error
se, and the percentile interval lower and
upper.
dropped: the number of draws dropped in each regime
because the refitted VAR was not stable.
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.
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)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)
Quarterly data for the house price application of Ahamada and Diaz Sanchez (2013), 1959:Q4 to 2009:Q3.
housinghousing
A data frame with 200 rows and 6 columns:
Quarter, such as "1960:Q1".
Log difference of real GDP.
Log difference of real personal consumption expenditures.
Log difference of the real home price index.
Federal funds rate, in percent, first month of the quarter.
Change in FFR.
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.
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.
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).
inflationinflation
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
of the consumer price index, adjusted for
outliers and seasonality by the authors.
The replication files of Bataa et al. (2013).
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.
Estimates structural breaks in a VAR whose coefficients are restricted by a fixed network matrix. With one lag, the model is
for observations in regime . With multiple lags, the model is
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)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)
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 |
The interpretation of testing$statistic depends on robust.
robust = "none" gives the SupLR statistic. The code can test
the parameters specified by coef_breaks, the disturbance
covariance when brv = 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. With
brv = TRUE, the estimates, standard errors and confidence
intervals account for the covariance breaks; under "hc" the
intervals further require errors without ARCH-type dependence.
An object of class c("netbreak", "sysbreak") containing:
specA summary of the setup, including the sample size
bigt, the number of equations n, the total number of NVAR
parameters per regime q, the arguments m, lags,
intercept, row_normalize, trim, brv,
robust, hetq, prewhit, test_level and
ci_level, the network matrix W, the equation and parameter
names, the retained input rows y_rows after discarding the lags,
and a record of the coef_breaks selector.
testingThe tests, reported at test_level:
statistic, testing no break against breaks for every
, with its critical_values;
statistic_type, "SupLR" or "SupF", and NA
when a requested robust test is unavailable; wdmax and
wdmax_critical_values; the sequential tests of
against breaks, each containing l, a statistic
and its critical_values; and the number of
changing_parameters, which includes the changing covariance
parameters when robust = "none".
br_selectedThe outcome of the break-number determination at
test_level: the selected number of breaks, the WDmax
statistic with its critical value and significance flag, and the
sequential steps taken. breaks is 0 when WDmax is
not significant, and NA when the tests are unavailable for the
requested specification.
estimationThe estimates related to the selected number of
breaks: estimated breaks; their confidence intervals
ci_breaks; coefficients by regimes and their confidence
intervals; disturbance covariance matrices. This component is
NULL when no break is detected, in which case only testing
and br_selected are informative.
spilloverWhen h is supplied and at least one break
is selected, regime-specific Diebold–Yilmaz generalized spillover
measures returned by dyspill.
yThe responses used in estimation, rows spec$y_rows
of y.
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.
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.
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$breaksset.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
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.
netsimnetsim
A list with two components:
A 300 by 20 matrix of observations, with columns node1 to
node20.
The 20 by 20 row-normalized network matrix. Entry
is if node follows node and 0 otherwise,
where is the number of nodes that follows.
In regime ,
Regime 1 has one lag, with and .
Regimes 2 and 3 have two lags, with ,
and ,
. The covariates are fixed, so
is a node intercept that changes across regimes. The
in-degrees of the network follow a power law, as in Zhu et al. (2017).
Simulated with set.seed(1) following Han and Lee (2024).
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.
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.
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)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)
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. |
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.
An object of class "ordbreak" containing:
specThe setup: the sample size
bigt, the number of equations n, the minimum segment length
h, the number of coefficients in each set q1 and q2,
the number of equations in the first set n1, the names of the
coefficients allowed to change at each date, changing1 and
changing2, the arguments trim, hetq and
trun, the input formulas split into set1 and set2,
the equation and coefficient names, the retained data rows
y_rows after discarding missing values, and the selection matrix
S.
testingThe SupLR statistic for ordered breaks,
sup_lr_ordered, its critical_values at test_level,
the pair truncated_breaks the statistic is computed at, and the
log-likelihoods H1like and H0like it 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 of
data; the coefficients beta1 and beta2 of the two
regimes; the residuals of the model at the estimated breaks, one
column per equation; and the coefficient shifts delta1
and delta2 occurring at the two dates; and ci_breaks, a
two by two matrix when confidence_intervals = TRUE and
NULL otherwise, also given as rows of data. Its rows are
the two break dates and its columns the lower and upper bounds at
ci_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.
Qu, Z., and Perron, P. (2007). Estimating and testing structural changes in multivariate regressions. Econometrica, 75(2), 459–502.
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$breaksset.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
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.
ordcheck(set1, set2, data, coef_breaks1 = "all", coef_breaks2 = "all")ordcheck(set1, set2, data, coef_breaks1 = "all", coef_breaks2 = "all")
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 |
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.
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))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))
Plots each series with the estimated break dates (dashed lines), their confidence intervals (shaded) and, optionally, the fitted values of the regime-specific model.
## S3 method for class 'sysbreak' plot(x, which = NULL, dates = NULL, fitted = TRUE, ...)## S3 method for class 'sysbreak' plot(x, which = NULL, dates = NULL, fitted = TRUE, ...)
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. |
x, invisibly.
sysbreak-methods, summary.sysbreak
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)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)
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.
## S3 method for class 'sysbreak' summary(object, ...) ## S3 method for class 'summary.sysbreak' print(x, digits = max(3L, getOption("digits") - 3L), ...)## S3 method for class 'sysbreak' summary(object, ...) ## S3 method for class 'summary.sysbreak' print(x, digits = max(3L, getOption("digits") - 3L), ...)
object |
A fit returned by |
... |
Not used. |
x |
An object returned by |
digits |
Number of significant digits in the coefficient tables. |
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, value and
two-sided -value, one table per regime, treating the break dates as
known.
sysbreak-methods, plot.sysbreak
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)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)
Estimation of a multiple-equation system affected by structural breaks in the regression coefficients and/or the variance covariance matrix of the residuals.
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)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)
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 |
The interpretation of testing$statistic depends on robust.
robust = "none" gives the SupLR statistic. The code can test
the coefficients specified by coef_breaks, the disturbance
covariance when brv = 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. With
brv = TRUE, the estimates, standard errors and confidence
intervals account for the covariance breaks; under "hc" the
intervals further require errors without ARCH-type dependence.
An object of class "sysbreak" containing:
specA summary of the setup, including the sample size
bigt, the number of equations n, the total number of
regression coefficients per regime q, the arguments m,
trim, brv, robust, hetq, prewhit,
test_level and ci_level, the input formula or formulas, the
equation and coefficient names, the retained data rows y_rows
after discarding missing values, and a record of the coef_breaks
selector.
testingThe tests, reported at test_level:
statistic, testing no break against breaks for every
, with its critical_values;
statistic_type, "SupLR" or "SupF", and NA
when a requested robust test is unavailable; wdmax and
wdmax_critical_values; the sequential tests of
against breaks, each containing l, a statistic
and its critical_values; and the number of
changing_parameters, which includes the changing covariance
parameters when robust = "none".
br_selectedThe outcome of the break-number determination at
test_level: the selected number of breaks, the WDmax
statistic with its critical value and significance flag, and the
sequential steps taken. breaks is 0 when WDmax is
not significant, and NA when the tests are unavailable for the
requested specification.
estimationThe estimates related to the selected number of
breaks: estimated breaks; their confidence intervals
ci_breaks; coefficients by regimes and their confidence
intervals; disturbance covariance matrices. This component is
NULL when no break is detected, in which case only testing
and br_selected are informative.
yThe responses used in estimation, rows spec$y_rows
of data.
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.
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.
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$breaksset.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
Fits returned by sysbreak,
varbreak and netbreak. All refer to the
estimates at the selected number of breaks.
## 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, ...)## 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, ...)
object |
A fit returned by |
... |
Not used. |
parm |
Breaks ( |
level |
Coverage probability. By default the |
type |
|
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" (equation y1, regressor x)
or "regime2:mu:node3" for netbreak. Coefficients held
constant by coef_breaks are repeated in every regime.
vcovThe covariance matrix of coef(), with rows
and columns in the same order and with the same names. When
coef_breaks holds 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. For type = "coef", the lower and upper
bounds of confidence intervals, estimate normal quantile times
standard error, treating the break dates as known.
residuals, fitted
Matrices 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.
summary.sysbreak, plot.sysbreak
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)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)
Estimation of a VAR affected by structural breaks in the regression coefficients and/or the variance covariance matrix of the residuals.
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)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)
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 |
The interpretation of testing$statistic depends on robust.
robust = "none" gives the SupLR statistic. The code can test
the coefficients specified by coef_breaks, the disturbance
covariance when brv = 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. With
brv = TRUE, the estimates, standard errors and confidence
intervals account for the covariance breaks; under "hc" the
intervals further require errors without ARCH-type dependence.
An object of class c("varbreak", "sysbreak") containing:
specA summary of the setup, including the sample size
bigt, the number of equations n, the total number of
coefficients per regime q, the arguments m, lags,
intercept, trim, brv, robust, hetq,
prewhit, test_level and ci_level, the equation and
coefficient names, the retained input rows y_rows after discarding
the lags, and the coef_breaks selector.
testingThe tests, reported at test_level:
statistic, testing no break against breaks for every
, with its critical_values;
statistic_type, "SupLR" or "SupF", and NA
when a requested robust test is unavailable; wdmax and
wdmax_critical_values; the sequential tests of
against breaks, each containing l, a statistic
and its critical_values; and the number of
changing_parameters, which includes the changing covariance
parameters when robust = "none".
br_selectedThe outcome of the break-number determination at
test_level: the selected number of breaks, the WDmax
statistic with its critical value and significance flag, and the
sequential steps taken. breaks is 0 when WDmax is
not significant, and NA when the tests are unavailable for the
requested specification.
estimationThe estimates related to the selected number of
breaks: estimated breaks; their confidence intervals
ci_breaks; coefficients by regimes and their confidence
intervals; disturbance covariance matrices. This component is
NULL when no break is detected, in which case only testing
and br_selected are informative.
spilloverWhen h is supplied and at least one break
is selected, regime-specific Diebold–Yilmaz generalized spillover
measures returned by dyspill.
yThe responses used in estimation, rows spec$y_rows
of y.
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.
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.
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$breaksset.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