# Example of multiple changes in mean and variance at 50,100,150 in simulated Exponential data
set.seed(1)
x=c(rexp(50,rate=1),rexp(50,rate=3),rexp(50,rate=1),rexp(50,rate=10))
PELT.meanvar.exp(x,pen=2*log(200)) # returns c(53,100,150,200)
PELT.meanvar.exp(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 scale parameter
set.seed(1)
x=rexp(200,rate=1)
PELT.meanvar.exp(x,pen=2*log(200)) # returns 200 to show no change in mean or variance has been found
PELT.meanvar.exp(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