ts_detect: Change point detection

Description Usage Arguments Value Examples

View source: R/ts_detect.R

Description

Detect change points in a time series using RelULSIF.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ts_detect(
  ts,
  window_size = 5,
  step = NULL,
  alpha = 0.05,
  k = 100,
  n_folds = 5,
  thresh = 0.9,
  make_plot = FALSE
)

Arguments

ts

Time series to detect change points in. Assumes this is a D by N matrix where D is the dimension of the time series and N is the number of time points. If a vector is provided, will assume the time series is one-dimensional.

window_size

The length of the sub-sequences generated from the series. Default 5.

step

How many sub-sequences forward and backward to from a time point to compute a score from. Default is 10% of the length of the series if not specified.

alpha

Relative parameter in [0, 1). Default 0.05. Setting to 0 recovers ordinary unconstrained least squares importance fitting.

k

Number of basis functions. Default is minimum of 100 and dimension of the time series.

n_folds

Number of folds to use in determining optimal kernel bandwidth and lambda parameter in RULSIF.

thresh

Scalar in (0, 1) indicating the percentile above which a score is considered a potential change-point. Lower values increase the sensitivity.

make_plot

Logical. On the same figure, make a plot of each dimension of the time series, the rPE scores, and highlight in the time series plots the change points detected in red. Default FALSE.

Value

List of 3:

Examples

1
2
3
s <- c(rnorm(150, mean = 0), rnorm(150, mean = 5), rnorm(150, mean = 1))
s <- matrix(s, nrow = 1)
ts_detect(s)

connorbrubaker/rulsif.ts documentation built on Dec. 19, 2021, 6:02 p.m.