CV.search.DP.poly {changepoints} R Documentation

## Grid search for dynamic programming to select the tuning parameter through Cross-Validation.

### Description

Perform grid search for dynamic programming to select the tuning parameter through Cross-Validation.

### Usage

CV.search.DP.poly(y, r, gamma_set, delta)


### Arguments

 y A numeric vector of observations. r An integer scalar order of polynomials. gamma_set A numeric vector of candidate tuning parameter associated with the l0 penalty. delta A positive integer scalar of minimum spacing.

### Value

A list with the following structure:

 cpt_hat A list of vector of estimated change points locations (sorted in strictly increasing order) K_hat A list of scalar of number of estimated change points test_error A list of vector of testing errors train_error A list of vector of training errors

Haotian Xu

### References

Yu and Chatterjee (2020) <arXiv:2007.09910>

### Examples

set.seed(0)
cpt_true = c(20, 50, 170)
y = rnorm(300) + c(rep(0,20),rep(2,30),rep(0,120),rep(2,130))
plot.ts(y)
gamma_set = 3:9
DP_result = CV.search.DP.poly(y, r = 2, gamma_set, delta = 5)
min_idx = which.min(DP_result$test_error) cpt_init = unlist(DP_result$cpt_hat[min_idx])
local.refine.poly(cpt_init, y, r = 2, delta_lr = 5)


[Package changepoints version 1.1.0 Index]