aARC {changepoints} | R Documentation |
Perform the adversarially robust change point detection method with automatic selection of the contamination proportion epsilon when treating the inliner distributions as Gaussian.
aARC(y, t_dat, guess_true = 0.05, h, block_num = 1)
y |
A |
t_dat |
A |
guess_true |
A |
h |
An |
block_num |
An |
An numeric
vector of estimated change point locations.
Mengchu Li
Li and Yu (2021) <arXiv:2105.10417>.
#' ### simulate data with contamination
obs_num = 1000
D = 2
noise = 0.1 # proportion of contamination
mu0 = 0
mu1 = 1
sd =1
idmixture = rbinom(obs_num/D, 1, 1-noise)
dat = NULL
for (j in 1:D){
for (i in 1:(obs_num/(2*D))){
if (idmixture[i] == 1){
dat = c(dat,rnorm(1,mu0,sd))
}
else{
dat = c(dat,rnorm(1,mu1/(2*noise),0))
}
}
for (i in (obs_num/(2*D)+1):(obs_num/D)){
if (idmixture[i] == 1){
dat = c(dat,rnorm(1,mu1,sd))
}
else{
dat = c(dat,rnorm(1,mu1/(2*noise)-(1-noise)*mu1/noise,0))
}
}
}
plot(dat)
### perform aARC
aARC(dat, dat[1:200], h = 120)