rkillick / changepoint

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

confusing warning/error #45

Closed tdhock closed 3 years ago

tdhock commented 3 years ago

hi @rkillick I'm using changepoint in my teaching https://github.com/tdhock/cs499-599-fall-2020/blob/master/homeworks/8.org I recommended my students use the code

changepoint::cpt.mean(logratio_vector, Q=100, method=”BinSeg”, penalty=”Manual”)

and one student was wondering if it is normal to see a lot of warnings. For example,

> fit6 <- changepoint::cpt.mean(rnorm(10), penalty="Manual", method="BinSeg", pen.value=0, Q=6)
Warning message:
In BINSEG(sumstat, pen = pen.value, cost_func = costfunc, minseglen = minseglen,  :
  The number of changepoints identified is Q, it is advised to increase Q to make sure changepoints have not been missed.
> 

But if I increase Q I get an error:

> fit7 <- changepoint::cpt.mean(rnorm(10), penalty="Manual", method="BinSeg", pen.value=0, Q=7)
Error in BINSEG(sumstat, pen = pen.value, cost_func = costfunc, minseglen = minseglen,  : 
  Q is larger than the maximum number of segments 6
> 

so that brings up two questions:

Thanks! Toby

rkillick commented 3 years ago

Ooooooh interesting!

Yes, I agree that this is a special case that isn't currently considered separately.

rkillick commented 3 years ago

Done in the github version. Not pushed to CRAN yet as i'm doing final tests on the cpt.reg function before the next release.

tdhock commented 3 years ago

great thanks for the quick response Rebecca!