Learn R Programming

changepoints (version 1.1.0)

DP.univar: Dynamic programming for univariate mean change points detection through \(l_0\) penalty.

Description

Perform dynamic programming for univariate mean change points detection.

Usage

DP.univar(y, gamma, delta)

Value

An object of class "DP", which is a list with the following structure:

partition

A vector of the best partition.

yhat

A vector of mean estimation for corresponding to the best partition.

cpt

A vector of change points estimation.

Arguments

y

A numeric vector of observations.

gamma

A numeric scalar of the tuning parameter associated with \(l_0\) penalty.

delta

A positive integer scalar of minimum spacing.

Author

Haotian Xu

References

Wang, Yu and Rinaldo (2020) <doi:10.1214/20-EJS1710>

Examples

Run this code
set.seed(123)
cpt_true = c(20, 50, 170)
y = rnorm(300) + c(rep(0,20),rep(1,30),rep(0,120),rep(1,130))
DP_result = DP.univar(y, gamma = 5, delta = 5)
cpt_hat = DP_result$cpt
Hausdorff.dist(cpt_hat, cpt_true)

Run the code above in your browser using DataLab