Learn R Programming

RegimeChange (version 0.1.1)

wild_binary_segmentation: Wild Binary Segmentation

Description

Detects multiple changepoints using the Wild Binary Segmentation algorithm. Uses random intervals to improve detection in long time series.

Usage

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

Value

A list with:

changepoints

Vector of detected changepoint locations

n_changepoints

Number of changepoints detected

information_criterion

BIC value for the segmentation

Arguments

data

Numeric vector or matrix of time series data

type

Type of change to detect: "mean", "variance", or "both"

penalty

Penalty for model complexity: "BIC", "AIC", "MBIC", or numeric

min_segment

Minimum segment length

n_changepoints

Expected number of changepoints: "single", "multiple", or integer

M

Number of random intervals to draw

threshold

Detection threshold for CUSUM statistic. If NULL, automatically determined

...

Additional arguments

References

Fryzlewicz, P. (2014). Wild Binary Segmentation for multiple change-point detection. Annals of Statistics, 42(6), 2243-2281.

Examples

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

Run the code above in your browser using DataLab