Learn R Programming

changepoints (version 1.1.0)

aARC: Automatic adversarially robust univariate mean change point detection.

Description

Perform the adversarially robust change point detection method with automatic selection of the contamination proportion epsilon when treating the inliner distributions as Gaussian.

Usage

aARC(y, t_dat, guess_true = 0.05, h, block_num = 1)

Value

An numeric vector of estimated change point locations.

Arguments

y

A numeric vector of observations.

t_dat

A numeric vector of observations that is used to select epsilon in the Huber contamination model.

guess_true

A numeric scalar representing a guess of epsilon value.

h

An integer scalar representing block size.

block_num

An integer scalar representing number of blocks used when searching for local maximiser.

Author

Mengchu Li

References

Li and Yu (2021) <arXiv:2105.10417>.

Examples

Run this code
#' ### 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)

Run the code above in your browser using DataLab