View source: R/wrap-regression.R
| envcpt_wrapper | R Documentation |
Wraps EnvCpt::envcpt() (Beaulieu and Killick, 2018), which fits up
to twelve competing models (constant mean or linear trend, each with or
without changepoints, and with white-noise, AR(1) or AR(2) errors) and
lets an information criterion decide whether the series really contains
changepoints or merely trend/autocorrelation ("memory"). The changepoints
of the winning model (if any) are returned, and the winning model's name
is recorded, guarding against the classic false positive of running a
mean-shift detector on autocorrelated data.
envcpt_wrapper(
x,
models = c("mean", "meancpt", "meanar1", "meanar2", "meanar1cpt", "meanar2cpt",
"trend", "trendcpt", "trendar1", "trendar2", "trendar1cpt", "trendar2cpt"),
criterion = c("AIC", "BIC"),
minseglen = 5,
...
)
x |
A numeric vector. |
models |
Character vector of models to fit; see
|
criterion |
Model selection criterion: |
minseglen |
Minimum segment length. Defaults to |
... |
Additional arguments passed to |
A ggcpt object. $fit holds the full envcpt
output; the selected model name is stored in the penalty descriptor and
printed by glance() via penalty_type. Individual model
fits that fail are expected (the criterion ignores them), so the
engine's own try() output is not passed on; genuine warnings
still are, and a series on which no model fits at all raises an error.
A constant series has no changepoints and is not handed to the engine,
so $fit is NULL there.
beaulieu2018envcptggchangepoint
Other changepoint engines:
bcp_wrapper(),
beast_wrapper(),
bfast_wrapper(),
binsegrcpp_wrapper(),
bocpd_wrapper(),
capa_wrapper(),
cpm_wrapper(),
cpop_wrapper(),
cpt_wrapper(),
decafs_wrapper(),
ecp_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(),
strucchange_wrapper(),
taylor_wrapper(),
tguh_wrapper(),
trend_wrapper(),
var_wrapper(),
wbs2_wrapper(),
wbs_wrapper(),
wbsts_wrapper()
set.seed(2026)
res <- envcpt_wrapper(c(rnorm(100), rnorm(100, 3)))
res$changepoints
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.