CV.search.DP.LR.regression {changepoints} R Documentation

## Grid search based on Cross-Validation of all tuning parameters (gamma, lambda and zeta) for regression.

### Description

Perform grid search based on Cross-Validation of all tuning parameters (gamma, lambda and zeta)

### Usage

CV.search.DP.LR.regression(
y,
X,
gamma_set,
lambda_set,
zeta_set,
delta,
eps = 0.001
)


### Arguments

 y A numeric vector of response variable. X A numeric matrix of covariates with vertical axis being time. gamma_set A numeric vector of candidate tuning parameter associated with the l0 penalty. lambda_set A numeric vector of candidate tuning parameter for the lasso penalty. zeta_set A numeric vector of candidate tuning parameter for the group lasso. delta A strictly positive integer scalar of minimum spacing. eps A numeric scalar of precision level for convergence of lasso.

### Value

A list with the following structure:

 cpt_hat A list of vector of estimated changepoints (sorted in strictly increasing order) K_hat A list of scalar of number of estimated changepoints test_error A list of vector of testing errors (each row corresponding to each gamma, and each column corresponding to each lambda) train_error A list of vector of training errors

### Author(s)

Daren Wang & Haotian Xu

### References

Rinaldo, Wang, Wen, Willett and Yu (2020) <arxiv:2010.10410>

### Examples

set.seed(123)
d0 = 8
p = 15
n = 100
cpt_true = c(30, 70)
data = simu.change.regression(d0, cpt_true, p, n, sigma = 1, kappa = 9)
gamma_set = c(0.01, 0.1)
lambda_set = c(0.01, 0.1)
temp = CV.search.DP.regression(y = data$y, X = data$X, gamma_set, lambda_set, delta = 2)
temp$test_error # test error result # find the indices of gamma_set and lambda_set which minimizes the test error min_idx = as.vector(arrayInd(which.min(temp$test_error), dim(temp$test_error))) gamma_set[min_idx[1]] lambda_set[min_idx[2]] cpt_init = unlist(temp$cpt_hat[min_idx[1], min_idx[2]])
zeta_set = c(0.1, 1)
temp_zeta = CV.search.DP.LR.regression(data$y, data$X, gamma_set[min_idx[1]],
lambda_set[min_idx[2]], zeta_set, delta = 2, eps = 0.001)
min_zeta_idx = which.min(unlist(temp_zeta$test_error)) cpt_LR = local.refine.regression(cpt_init, data$y, X = data\$X, zeta = zeta_set[min_zeta_idx])
Hausdorff.dist(cpt_init, cpt_true)
Hausdorff.dist(cpt_LR, cpt_true)


[Package changepoints version 1.1.0 Index]