Learn R Programming

RegimeChange (version 0.1.1)

binary_segmentation: Binary Segmentation Changepoint Detection

Description

Recursive binary segmentation for changepoint detection. Greedy algorithm that recursively splits at the best changepoint.

Usage

binary_segmentation(
  data,
  type = "both",
  penalty = "BIC",
  min_segment = 2,
  n_changepoints = "multiple",
  threshold = NULL,
  ...
)

Value

List with changepoints

Arguments

data

Numeric vector or matrix

type

Type of change to detect

penalty

Penalty for adding changepoints

min_segment

Minimum segment length

n_changepoints

Maximum number of changepoints to detect

threshold

Significance threshold

...

Additional arguments

Examples

Run this code
data <- c(rnorm(100), rnorm(100, mean = 2))
result <- binary_segmentation(data)

Run the code above in your browser using DataLab