segment {tidychangepoint} | R Documentation |
Segment a time series using a variety of algorithms
Description
A wrapper function that encapsulates various algorithms for detecting changepoint sets in univariate time series.
Usage
segment(x, method = "null", ...)
## S3 method for class 'tbl_ts'
segment(x, method = "null", ...)
## S3 method for class 'xts'
segment(x, method = "null", ...)
## S3 method for class 'numeric'
segment(x, method = "null", ...)
## S3 method for class 'ts'
segment(x, method = "null", ...)
Arguments
x |
a numeric vector coercible into a stats::ts object |
method |
a character string indicating the algorithm to use. See Details. |
... |
arguments passed to methods |
Details
Currently, segment()
can use the following algorithms, depending
on the value of the method
argument:
-
pelt
: Uses the PELT algorithm as implemented insegment_pelt()
, which wraps eitherchangepoint::cpt.mean()
orchangepoint::cpt.meanvar()
. Thesegmenter
is of classcpt
. -
binseg
: Uses the Binary Segmentation algorithm as implemented bychangepoint::cpt.meanvar()
. Thesegmenter
is of classcpt
. -
segneigh
: Uses the Segmented Neighborhood algorithm as implemented bychangepoint::cpt.meanvar()
. Thesegmenter
is of classcpt
. -
single-best
: Uses the AMOC criteria as implemented bychangepoint::cpt.meanvar()
. Thesegmenter
is of classcpt
. -
wbs
: Uses the Wild Binary Segmentation algorithm as implemented bywbs::wbs()
. Thesegmenter
is of classwbs
. -
ga
: Uses the Genetic algorithm implemented bysegment_ga()
, which wrapsGA::ga()
. Thesegmenter
is of classtidyga
. -
ga-shi
: Uses the genetic algorithm implemented bysegment_ga_shi()
, which wrapssegment_ga()
. Thesegmenter
is of classtidyga
. -
ga-coen
: Uses Coen's heuristic as implemented bysegment_ga_coen()
. Thesegmenter
is of classtidyga
. This implementation supersedes the following one. -
coen
: Uses Coen's heuristic as implemented bysegment_coen()
. Thesegmenter
is of classseg_basket()
. Note that this function is deprecated. -
random
: Uses a random basket of changepoints as implemented bysegment_ga_random()
. Thesegmenter
is of classtidyga
. -
manual
: Uses the vector of changepoints in thetau
argument. Thesegmenter
is of class seg_cpt'. -
null
: The default. Uses no changepoints. Thesegmenter
is of class seg_cpt.
Value
An object of class tidycpt.
See Also
changepoint::cpt.meanvar()
, wbs::wbs()
, GA::ga()
,
segment_ga()
Examples
# Segment a time series using PELT
segment(DataCPSim, method = "pelt")
# Segment a time series using PELT and the BIC penalty
segment(DataCPSim, method = "pelt", penalty = "BIC")
# Segment a time series using Binary Segmentation
segment(DataCPSim, method = "binseg", penalty = "BIC")
# Segment a time series using a random changepoint set
segment(DataCPSim, method = "random")
# Segment a time series using a manually-specified changepoint set
segment(DataCPSim, method = "manual", tau = c(826))
# Segment a time series using a null changepoint set
segment(DataCPSim)