# Example of a change in mean and variance at 100 in simulated Exponential data
set.seed(10)
x=c(rexp(100,rate=1),rexp(100,rate=5))
single.meanvar.exp(x,penalty="SIC",class=FALSE) # returns 99 to show that the null hypothesis was rejected and the change in mean and variance is at 99
ans=single.meanvar.exp(x,penalty="AIC")
cpts(ans) # returns 99 to show that the null hypothesis was rejected, the change in mean and variance is at 99
# Example of a data matrix containing 2 rows, row 1 has a change in scale parameter and row 2 had no change in scale parameter
set.seed(10)
x=c(rexp(100,rate=1),rexp(100,rate=10))
y=rexp(200,rate=1)
z=rbind(x,y)
single.meanvar.exp(z,penalty="SIC",class=FALSE) # returns vector c(99,200) which shows that the first dataset has a change in scale parameter at 99 and the second dataset rejected H1 and has no change in scale parameter
ans=single.meanvar.exp(z,penalty="Manual",value="diffparam*log(n)") # list returned
cpts(ans[[1]]) # test using a manual penalty which is the same as the SIC penalty for this example. The same changepoint is detected for the first dataset
cpts(ans[[2]]) # same as above, no change found
Run the code above in your browser using DataLab