changepoints function

Extract changepoints

Extract changepoints

Retrieve the indices of the changepoints identified by an algorithm or model.

changepoints(x, ...) ## Default S3 method: changepoints(x, ...) ## S3 method for class 'mod_cpt' changepoints(x, ...) ## S3 method for class 'seg_basket' changepoints(x, ...) ## S3 method for class 'seg_cpt' changepoints(x, ...) ## S3 method for class 'tidycpt' changepoints(x, use_labels = FALSE, ...) ## S3 method for class 'ga' changepoints(x, ...) ## S3 method for class 'cpt' changepoints(x, ...) ## S3 method for class 'wbs' changepoints(x, ...)

Arguments

  • x: A tidycpt , segmenter, or mod_cpt object
  • ...: arguments passed to methods
  • use_labels: return the time labels for the changepoints instead of the indices.

Returns

a numeric vector of changepoint indices, or, if use_labels is TRUE, a character of time labels.

Details

tidycpt objects, as well as their segmenter and model components, implement changepoints() methods.

Note that this function is not to be confused with wbs::changepoints(), which returns different information.

For the default method, changepoints() will attempt to return the cpt_true attribute, which is set by test_set().

Examples

cpts <- segment(DataCPSim, method = "ga", maxiter = 5) changepoints(cpts$segmenter) cpts <- segment(DataCPSim, method = "wbs") changepoints(cpts$segmenter)

See Also

wbs::changepoints()

Other tidycpt-generics: as.model(), as.segmenter(), diagnose(), fitness(), model_name()