multiple.mean.cusum(data,mul.method="BinSeg",penalty="Asymptotic",pen.value=0.05,Q=5,
class=TRUE,param.estimates=TRUE)
cpt
is returned.cpts
contains the changepoints that are solely returned if class=FALSE. The structure of cpts
is as follows.If data is a vector (single dataset) then a vector/list is returned depending on the value of mul.method. If data is a matrix (multiple datasets) then a list is returned where each element in the list is either a vector or list depending on the value of mul.method.
If mul.method is SegNeigh then a list is returned with elements:
Segment Neighbourhoods: Auger, I. E. And Lawrence, C. E. (1989) Algorithms for the Optimal Identification of Segment Neighborhoods, Bulletin of Mathematical Biology 51(1), 39--54
M. Csorgo, L. Horvath (1997) Limit Theorems in Change-Point Analysis, Wiley
E. S. Page (1954) Continuous Inspection Schemes, Biometrika 41(1/2), 100--115
multiple.var.css
,cpt.mean
,binseg.mean.cusum
,single.mean.cusum
,segneigh.mean.cusum
,cpt
# Example of multiple changes in mean at 50,100,150 in simulated data
set.seed(1)
x=c(rnorm(50,0,1),rnorm(50,5,1),rnorm(50,10,1),rnorm(50,3,1))
multiple.mean.cusum(x,mul.method="BinSeg",penalty="Manual",pen.value=0.8,Q=5,class=FALSE) # returns
#optimal number of changepoints is 3, locations are 50,100,150.
# Example multiple datasets where the first row has multiple changes in mean and the second row has
#no change in mean
set.seed(1)
x=c(rnorm(50,0,1),rnorm(50,5,1),rnorm(50,10,1),rnorm(50,3,1))
y=rnorm(200,0,1)
z=rbind(x,y)
multiple.mean.cusum(z,mul.method="SegNeigh",penalty="Manual",pen.value=1,Q=5,class=FALSE) # returns
#list that has two elements, the first has 3 changes in mean at 50,101,150 and the second has no
#changes in mean
ans=multiple.mean.cusum(z,mul.method="BinSeg",penalty="Manual",pen.value=0.8)
cpts(ans[[1]]) # same results as for the SegNeigh method.
cpts(ans[[2]]) # same results as for the SegNeigh method.
Run the code above in your browser using DataLab