CI.regression {changepoints} R Documentation

## Confidence interval construction of change points for regression settings with change points.

### Description

Construct element-wise confidence interval for change points.

### Usage

CI.regression(
cpt_init,
cpt_LR,
beta_hat,
y,
X,
w = 0.9,
B = 1000,
M,
alpha_vec,
rounding = TRUE
)


### Arguments

 cpt_init An integer vector of initial changepoints estimation (sorted in strictly increasing order). cpt_LR An integer vector of refined changepoints estimation (sorted in strictly increasing order). beta_hat A numeric (px(K_hat+1))matrix of estimated regression coefficients. y A numeric vector of response variable. X A numeric matrix of covariates with vertical axis being time. w A numeric scalar in (0,1) representing the weight for interval truncation. B An integer scalar corresponding to the number of simulated two-sided Brownian motion with drift. M An integer scalar corresponding to the length for each side of the limiting distribution, i.e. the two-sided Brownian motion with drift. alpha_vec An numeric vector in (0,1) representing the vector of significance levels. rounding A boolean scalar representing if the confidence intervals need to be rounded into integer intervals.

### Value

An length(cpt_init)-2-length(alpha_vec) array of confidence intervals.

Haotian Xu

### References

Xu, Wang, Zhao and Yu (2022) <arXiv:2207.12453>.

Xu, Wang, Zhao and Yu (2022) <arXiv:2207.12453>.

### Examples

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) cpt_LR = local.refine.DPDU.regression(cpt_init, beta_hat, data$y, data$X, w = 0.9) alpha_vec = c(0.01, 0.05, 0.1) CI.regression(cpt_init, cpt_LR, beta_hat, data$y, data\$X, w = 0.9, B = 1000, M = n, alpha_vec)


[Package changepoints version 1.1.0 Index]