Tcl Library Source Code

EuroTcl/OpenACS 11 - 12 JULY 2024, VIENNA

[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]


math::changepoint - Change point detection methods

Table Of Contents


package require Tcl 8.6 9
package require TclOO
package require math::statistics
package require math::changepoint ?0.2?

::math::changepoint::cusum-detect data ?args?
::math::changepoint::cusum-online ?args?
$cusumObj examine value
$cusumObj reset
::math::changepoint::binary-segmentation data ?args?


The math::changepoint package implements a number of well-known methods to determine if a series of data contains a shift in the mean or not. Note that these methods only indicate if a shift in the mean is probably. Due to the stochastic nature of the data that will be analysed, false positives are possible. The CUSUM method is implemented in both an "offline" and an "online" version, so that it can be used either for a complete data series or for detecting changes in data that come in one by one. The implementation has been based on these websites mostly:

Basically, the deviation of the data from a given target value is accumulated and when the total deviation becomes too large, a change point is reported. A second method, binary segmentation, is implemented only as an "offline" method, as it needs to examine the data series as a whole. In the variant contained here the following ideas have been used:

This may not be in agreement with the descriptions of the method found in various publications, but it is simple to understand and intuitive. One publication that provides more information on the method in general is "Selective review of offline change point detection methods" by Truong et al.


The package defines the following public procedures:


control, statistics




Copyright © 2020 by Arjen Markus