# NOT RUN {
## a univariate example
n <- 100
k <- 50 ## the true change-point
y <- rnorm(k)
z <- rexp(n-k)
x <- matrix(c(y,z))
cp <- cpTestFn(x)
cp
## all statistics
cp$all.statistics
## corresponding p.values
cp$all.p.values
## estimated change-point
which(cp$cvm == max(cp$cvm))
which(cp$ks == max(cp$ks))
## a very artificial trivariate example
## with a break in the first margin
n <- 100
k <- 50 ## the true change-point
y <- rnorm(k)
z <- rnorm(n-k,mean=2)
x <- cbind(c(y,z),matrix(rnorm(2*n),n,2))
cp <- cpTestFn(x)
cp
## all statistics
cp$all.statistics
## corresponding p.values
cp$all.p.values
## estimated change-point
which(cp$cvm == max(cp$cvm))
which(cp$ks == max(cp$ks))
# }
Run the code above in your browser using DataLab