Skip to contents

Wraps ChangePointTaylor::change_point_analyzer(): the bootstrap-and-recursion procedure of Wayne Taylor that the quality-control and Six Sigma community uses as its default. Each candidate is scored by the bootstrap probability that a change occurred there, which gives a confidence level per changepoint and a confidence interval for its location, both carried onto the result.

Usage

taylor_wrapper(
  x,
  n_bootstraps = 1000,
  min_candidate_conf = 0.5,
  min_conf = 0.9,
  conf_level = 0.95,
  seed = NULL
)

Arguments

x

A numeric vector.

n_bootstraps

Bootstrap samples per candidate. Defaults to 1000; the engine accepts 100 to 1,000,000.

min_candidate_conf

Minimum confidence for a candidate to be considered, between 0.3 and 1. Defaults to 0.5.

min_conf

Minimum confidence for a changepoint to be reported, between 0.5 and 1. Defaults to 0.9.

conf_level

Confidence level of the reported location intervals, between 0.9 and 0.999 (the engine's range). Defaults to 0.95.

seed

Optional seed (the procedure is bootstrap-based). The seed is scoped to this call: .Random.seed is saved and restored, so a seeded call inside a simulation loop does not pin the loop's own stream.

Value

A ggcpt object with ci_lower/ci_upper (so autoplot(show_ci = TRUE) works) and a confidence column.

Series length, and why you cannot interrupt it

This engine is written for the series lengths quality control sees (hundreds to low thousands), and it does not scale. At \(n = 10{,}000\) with the default n_bootstraps = 1000 it runs for minutes, and more importantly it runs where R cannot look: a setTimeLimit() of 45 seconds was still not honoured after 170, and one of 125 seconds after 200, so the call had to be killed from outside the session. R checks elapsed-time limits and keyboard interrupts at the same points, which means Ctrl-C will not stop it either.

So size the call before starting it rather than after. n_bootstraps is the knob (the cost is roughly linear in it), and the “Benchmarks” article lists the methods that do scale to long series. That page is web-only, because the sweep behind it takes over twenty minutes: it is published at https://pursuitofdatascience.github.io/ggchangepoint/articles/benchmarks.html rather than built into the package, so vignette() will not find it.

References

Taylor WA (2000). Change-Point Analysis: A Powerful New Tool for Detecting Changes. Taylor Enterprises, Libertyville, Illinois.

Examples

set.seed(2026)
taylor_wrapper(c(rnorm(60), rnorm(60, 3)), n_bootstraps = 200, seed = 1)
#> ggcpt (changepoint detection result)
#>   Method:             taylor
#>   Change in:          mean
#>   Changepoints found: 2
#>   CP convention:      left
#>   Penalty:            confidence = 0.9
#>   Series length:      120
#> 
#> Changepoints:
#> # A tibble: 2 × 5
#>      cp cp_value ci_lower ci_upper confidence
#>   <int>    <dbl>    <int>    <int>      <dbl>
#> 1    15   -2.55         6       50          1
#> 2    60   -0.999       59       61          1