
Bai-Perron structural break wrapper (strucchange)
Source:R/wrap-regression.R
strucchange_wrapper.RdWraps strucchange::breakpoints() (Zeileis et al., 2002), the
dynamic-programming implementation of the Bai and Perron (1998, 2003)
multiple structural break estimator. Called with a bare numeric vector it
dates mean shifts (y ~ 1); called with a formula and data it dates
breaks in arbitrary regression coefficients. Break-date confidence
intervals from confint() populate ci_lower/ci_upper
and render via autoplot(show_ci = TRUE).
Arguments
- x
A numeric vector (mean-shift mode), or a model formula (regression mode; supply
datatoo).- data
Optional data frame for formula input.
- breaks
Maximum number of breaks; when
NULLthe number is chosen by BIC.- h
Minimal segment size, as a fraction of the sample size (or an integer count). Defaults to
0.15.- conf_level
Confidence level for the break-date intervals. Defaults to
0.95.- ...
Additional arguments passed to
strucchange::breakpoints().
Result size
$fit is the breakpoints object itself, and that object is
quadratic in the series length: it keeps RSS.triang, the triangular
table of segment residual sums of squares, which is what lets
strucchange return the optimal segmentation for any number
of breaks without refitting. Measured here, the whole result is about
1.7 MB at n = 200, 5.9 MB at n = 400 and 22.6 MB at
n = 800 — roughly four times larger each time the series doubles —
and that one table outweighs everything else in the fit put together, by a
margin that widens as the series grows. A single fit is not a problem; a
few hundred of them are, so when running this engine over a panel with
cpt_batch() keep what you need
(res$changepoints) rather than the whole list of results. No other
engine here behaves this way: the median result across the others is
under ten times the size of the series it was given.
References
Bai J, Perron P (2003). “Computation and analysis of multiple structural change models.” Journal of Applied Econometrics, 18(1), 1–22.
Zeileis A, Leisch F, Hornik K, Kleiber C (2002). “strucchange: An R package for testing for structural change in linear regression models.” Journal of Statistical Software, 7(2), 1–38.
See also
Other changepoint engines:
bcp_wrapper(),
beast_wrapper(),
bfast_wrapper(),
binsegrcpp_wrapper(),
bocpd_wrapper(),
cpm_wrapper(),
cpop_wrapper(),
cpt_wrapper(),
decafs_wrapper(),
ecp_wrapper(),
envcpt_wrapper(),
esac_wrapper(),
fabisearch_wrapper(),
fastcpd_wrapper(),
fcov_wrapper(),
fmean_wrapper(),
fpop_wrapper(),
geomcp_wrapper(),
hdcov_wrapper(),
hdreg_wrapper(),
idetect_wrapper(),
inspect_wrapper(),
kcp_wrapper(),
kwc_wrapper(),
mcp_wrapper(),
mosum_wrapper(),
network_wrapper(),
not_wrapper(),
npmojo_wrapper(),
nsp_wrapper(),
ocd_wrapper(),
pilliat_wrapper(),
segmented_wrapper(),
smuce_wrapper(),
sn_wrapper(),
taylor_wrapper(),
tguh_wrapper(),
trend_wrapper(),
var_wrapper(),
wbs2_wrapper(),
wbs_wrapper(),
wbsts_wrapper()