where Xˉt=t−1∑s=1tXs and c("tildeXT−t=\n", "(T−t)−1sums=t+1TXs"). In this implementation, T is computed automatically as length(x) and k corresponds to t, a potential change point.
Examples
CPAT:::cpt_consistent_var(c(rnorm(500, mean =0), rnorm(500, mean =1)), k =500)