View source: R/univariate_polynomial.R
CV.search.DP.poly | R Documentation |
Perform grid search for dynamic programming to select the tuning parameter through Cross-Validation.
CV.search.DP.poly(y, r, gamma_set, delta)
y |
A |
r |
An |
gamma_set |
A |
delta |
A positive |
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
Yu and Chatterjee (2020) <arXiv:2007.09910>
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.