Runs several detectors on the same data and returns a faceted or overlaid
ggplot comparison. Respects future::plan() for parallel execution
if the future.apply package is available.
Arguments
- x
A numeric vector (the data series). A one-column matrix or data frame is accepted; wider input is refused, because these detectors are univariate and flattening the columns would invent a changepoint at every seam. Use
cpt_batch()for a panel of series.- methods
Character vector of method names (passed to
cpt_detect).- layout
Layout type.
"facet"(default) shows one panel per method;"overlay"draws all changepoints in one panel, colour-coded. The overlay dodges the rules horizontally so that two methods agreeing on an index are both visible, which moves each rule by up to half an observation, so read positions off"facet", or offtidy(), and treat the overlay as a picture of agreement rather than of location.- change_in
What to detect change in. Passed to each detector.
- seed
Optional seed for reproducible parallelism. Passed to
future.apply::future_lapply()asfuture.seed, and toset.seed()when running sequentially. LeftNULLunder a parallel plan,future.seed = TRUEis used, so the workers get parallel-safe streams but the run is not reproducible. The seed is scoped to this call:.Random.seedis saved and restored, so a seeded call inside a simulation loop does not pin the loop's own stream.- ...
Additional arguments passed to each detector.
Positions, not a time index
Unlike cpt_detect(), cpt_batch() and
autoplot.ggcpt(), these two take no index: the
input is reduced to a bare numeric vector, so a ts, xts,
zoo or tsibble is plotted (and tabulated) in observation
positions with an "Index" axis. To compare detectors on dated data, run
cpt_detect(x, method = m, index = dates) per method and read
tidy()'s cp_index, or plot the results with
autoplot().

