Learn R Programming

changepoints (version 1.1.0)

online.univar: Online change point detection with controlled false alarm rate or average run length.

Description

Perform online change point detection with controlled false alarm rate or average run length.

Usage

online.univar(
  y_vec,
  b_vec = NULL,
  train_vec = NULL,
  alpha = NULL,
  gamma = NULL,
  permu_num = NULL
)

Value

A list with the following structure:

cpt_hat

An integer scalar of estimated change point location

b_vec

A numeric vector of thresholds b_t with t >= 2

Arguments

y_vec

A numeric vector of observations.

b_vec

A numeric vector of thresholds b_t with t >= 2.

train_vec

A numeric vector of training data from a pre-change distribution (no change point), which is only needed to when b_vec is NULL in order to calibrate b_t.

alpha

A numeric scalar of desired false alarm rate.

gamma

An integer scalar of desired average run length.

permu_num

An integer scalar of number of random permutation for calibration.

Author

Haotian Xu

References

Yu, Padilla, Wang and Rinaldo (2020) <arxiv:2006.03283>

Examples

Run this code
y_vec = rnorm(150) + c(rep(0, 100), rep(1, 50))
train_vec = rnorm(100)
# control the false alarm rate
temp1 = online.univar(y_vec = y_vec, train_vec = train_vec, alpha = 0.05, permu_num = 20)
temp1$cpt_hat
temp1$b_vec # calibrated threshold

Run the code above in your browser using DataLab