Skip to contents

Wraps the breakfast package's WBS2 solution path with steepest-drop-to-low-levels (SDLL) model selection.

Usage

wbs2_wrapper(x, ...)

Arguments

x

A numeric vector.

...

Additional arguments passed to breakfast::breakfast().

Value

A ggcpt object.

Reproducibility

This engine is not reproducible call to call within an R session, and no argument here can make it so. On a 200-point series with one change at 100, repeated identical calls (same input, set.seed() re-run beforehand so that .Random.seed is byte-identical on entry) return a last changepoint of either 183 or 188, roughly evenly split. The variation is therefore not driven by R's random number stream, which is why this wrapper has no seed argument to offer: there is no stream to pin.

It is upstream, not in this package. Calling breakfast::breakfast(x, solution.path = "wbs2", model.selection = "sdll") directly (breakfast 2.5) reproduces it exactly. A fresh R session is deterministic (five separate sessions agreed), so what varies is state the engine carries between calls.

In practice this is rare, and needs a series whose model selection sits near a tie. Measured over eight other series with three identical calls each, wbs2 was stable on all eight; the flip above reproduces only on that one configuration. tguh, which uses the same package, was stable throughout, as were the other 35 of the 50 wired methods this experiment covered (the rest need an engine that was not installed when it was run). If you need a segmentation you can reproduce exactly, take the result of the first call in a session, or use an engine with a seed argument (cpt_methods() reports which wrappers have one).

References

Fryzlewicz P (2020). “Detecting Multiple Change-Point Features via Narrowest-Over-Threshold.” Journal of the Royal Statistical Society Series B, 82(5), 1377–1418.

Examples

set.seed(2026)
res <- wbs2_wrapper(c(rnorm(60), rnorm(60, 4)))
res$changepoints
#> # A tibble: 1 × 2
#>      cp cp_value
#>   <int>    <dbl>
#> 1    60   -0.999