View source: R/HD_regression.R
LRV.regression | R Documentation |
Estimating long-run variance for regression settings with change points.
LRV.regression(cpt_init, beta_hat, y, X, w = 0.9, block_size)
cpt_init |
An |
beta_hat |
A |
y |
A |
X |
A |
w |
A |
block_size |
An |
A vector of long-run variance estimators associated with all local refined intervals.
Haotian Xu
Xu, Wang, Zhao and Yu (2022) <arXiv:2207.12453>.
Xu, Wang, Zhao and Yu (2022) <arXiv:2207.12453>.
d0 = 5 p = 10 n = 200 cpt_true = c(70, 140) data = simu.change.regression(d0, cpt_true, p, n, sigma = 1, kappa = 9) lambda_set = c(0.1, 0.5, 1, 2) zeta_set = c(10, 15, 20) temp = CV.search.DPDU.regression(y = data$y, X = data$X, lambda_set, zeta_set) temp$test_error # test error result # find the indices of lambda_set and zeta_set which minimizes the test error min_idx = as.vector(arrayInd(which.min(temp$test_error), dim(temp$test_error))) lambda_set[min_idx[2]] zeta_set[min_idx[1]] cpt_init = unlist(temp$cpt_hat[min_idx[1], min_idx[2]]) beta_hat = matrix(unlist(temp$beta_hat[min_idx[1], min_idx[2]]), ncol = length(cpt_init)+1) interval_refine = trim_interval(n, cpt_init) # choose S block_size = ceiling(sqrt(min(floor(interval_refine[,2]) - ceiling(interval_refine[,1])))/2) LRV_est = LRV.regression(cpt_init, beta_hat, data$y, data$X, w = 0.9, block_size)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.