rkillick / changepoint

A place for the development version of the changepoint package on CRAN.
127 stars 33 forks source link

BinSeg returns zeros in cpts.full matrix #69

Open tdhock opened 2 years ago

tdhock commented 2 years ago

hi @rkillick I'm running your implementation of binary segmentation, and I'm wondering what it means when there are zeros in the cpts.full matrix? I expected that all entries of the cpts.full matrix should be between 1 and the number of data points, so is this a bug? For example,

> changepoint::cpt.mean(1:4, method="BinSeg", Q=3)@cpts.full
     [,1] [,2] [,3]
[1,]    0   NA   NA
[2,]    0    0   NA
[3,]    0    0    0

In this case I get all zeros, which is highly unexpected. I expected the first changepoint to be at 2, then the next two to be at 1 and 3. Another example is

> changepoint::cpt.mean(1:8, method="BinSeg", Q=3)@cpts.full
     [,1] [,2] [,3]
[1,]    4   NA   NA
[2,]    4    2   NA
[3,]    4    2    0

The output above shows that the first two changepoints are as expected. However the third changepoint is zero whereas I expected it should be 6.