segment_pelt: Segment a time series using the PELT algorithm

View source: R/segment_pelt.R

segment_peltR Documentation

Segment a time series using the PELT algorithm

Description

Segmenting functions for the PELT algorithm

Usage

segment_pelt(x, model_fn = fit_meanvar, ...)

Arguments

x

A time series

model_fn

A character or name coercible into a fun_cpt function. See, for example, fit_meanshift_norm(). The default is fit_meanvar().

...

arguments passed to changepoint::cpt.meanvar() or changepoint::cpt.mean()

Details

This function wraps either changepoint::cpt.meanvar() or changepoint::cpt.mean().

Value

A cpt object returned by changepoint::cpt.meanvar() or changepoint::cpt.mean()

Examples

# Segment a time series using PELT
res <- segment_pelt(DataCPSim)
res
str(res)

# Segment as time series while specifying a penalty function
segment_pelt(DataCPSim, penalty = "BIC")

# Segment a time series while specifying a meanshift normal model
segment_pelt(DataCPSim, model_fn = fit_meanshift_norm, penalty = "BIC")


tidychangepoint documentation built on April 4, 2025, 4:31 a.m.