View source: R/univariate_mean.R
CV.search.DP.univar | R Documentation |
Perform grid search for dynamic programming to select the tuning parameter through Cross-Validation.
CV.search.DP.univar(y, gamma_set, delta)
y |
A |
gamma_set |
A |
delta |
A positive |
A list
with the following structure:
cpt_hat |
A list of vector of estimated change points (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. |
Daren Wang & Haotian Xu
Wang, Yu and Rinaldo (2020) <doi:10.1214/20-EJS1710>
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)) gamma_set = 1:5 DP_result = CV.search.DP.univar(y, gamma_set, delta = 5) min_idx = which.min(DP_result$test_error) cpt_hat = unlist(DP_result$cpt_hat[min_idx]) Hausdorff.dist(cpt_hat, cpt_true)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.