# Example of multiple changes in variance at 50,100,150 in simulated normal data
set.seed(1)
x=c(rnorm(50,0,1),rnorm(50,0,10),rnorm(50,0,5),rnorm(50,0,1))
PELT.var.norm(x,pen=2*log(200)) # returns c(50,99,150,200)
PELT.var.norm(x,pen=2*log(200),nprune=TRUE) # returns vector showing how many points are kept during pruing at each iteration of the method
# Example no change in variance
set.seed(10)
x=rnorm(200,0,1)
PELT.var.norm(x,pen=2*log(200)) # returns 200 to show no change in variance has been found
PELT.var.norm(x,pen=2*log(200),nprune=TRUE) # notice how the number of points kept it steadily increasing compare to the previous example where it almost resets when a true change has been found
Run the code above in your browser using DataLab