[R] problem (un)detecting changepoints

Enrico R. Crema enrico.crema at gmail.com
Mon Jan 27 14:00:54 CET 2014


Dear List,

I am using the cpt.mean() function in the "changepoint" package to detect change-points in my data and noticed that when there are no visible changes, the function returns the last point as the point of change. The following script can illustrate this:

table(unlist(replicate(500,cpt.mean(rnorm(50),method="PELT")@cpts)))

the result will return a uniform distribution from 1 to 49 (with ca 20 cpts located for each), and then 500 cases where the cpts is located on the last vector. Clearly, cpt.mean returns the index of the last vector value (here 50) for change in the time-series. I wonder if I am doing something wrong here, but I think the function should return a NA... 

Many thanks in advance,
Enrico 



More information about the R-help mailing list