## AR1 example
n <- 200
k <- n/2 ## the true change-point
x <- matrix(c(arima.sim(list(ar = -0.1), n = k),
arima.sim(list(ar = 0.5), n = n - k)))
stDistAutocop(x)
## AR2 example
n <- 200
k <- n/2 ## the true change-point
x <- matrix(c(arima.sim(list(ar = c(0,-0.1)), n = k),
arima.sim(list(ar = c(0,0.5)), n = n - k)))
if (FALSE) {
stDistAutocop(x)
stDistAutocop(x, lag = 2)}
stDistAutocop(x, lag = 2, pairwise = TRUE)
Run the code above in your browser using DataLab