pcm_th: Multiple change-point detection in the mean via thresholding

View source: R/Finalised_coding.R

pcm_thR Documentation

Multiple change-point detection in the mean via thresholding

Description

This function performs the Isolate-Detect methodology (see Details for the relevant literature reference) with the thresholding-based stopping rule in order to detect multiple change-points in the mean of a given data sequence.

Usage

pcm_th(
  x,
  sigma = stats::mad(diff(x)/sqrt(2)),
  thr_const = 1,
  thr_fin = sigma * thr_const * sqrt(2 * log(length(x))),
  s = 1,
  e = length(x),
  points = 3,
  k_l = 1,
  k_r = 1
)

Arguments

x

A numeric vector containing the data in which you would like to find change-points.

sigma

A positive real number. It is the estimate of the standard deviation of the noise in x. The default value is the median absolute deviation of x computed under the assumption that the noise is independent and identically distributed from the Gaussian distribution.

thr_const

A positive real number with default value equal to 1. It is used to define the threshold. The change-points are estimated by thresholding with threshold equal to sigma * thr_const * sqrt(2 * log(l)), where l is the length of the data sequence x.

thr_fin

A positive real number with default value equal to sigma * thr_const * sqrt(2 * log(l)), where l is the length of the data sequence x. It is the threshold, which is used in the detection process.

s, e

Positive integers with s less than e, which indicate that you want to check for change-points in the data sequence with subscripts in [s,e]. The default values are s equal to 1 and e equal to l, with l the length of the data sequence.

points

A positive integer with default value equal to 3. It defines the distance between two consecutive end- or start-points of the right- or left-expanding intervals, respectively.

k_l, k_r

Positive integer numbers that get updated whenever the function calls itself during the detection process. They are not essential for the function to work, and we include them only to reduce the computational time.

Details

The change-point detection algorithm that is used in pcm_th is the Isolate-Detect methodology described in “Detecting multiple generalized change-points by isolating single ones”, Anastasiou and Fryzlewicz (2017), preprint. The concept is simple and is split into two stages; firstly, isolation of each of the true changepoints in small intervals, and secondly their detection.

Value

A numeric vector with the detected change-points.

Author(s)

Andreas Anastasiou, anastasiou.andreas@ucy.ac.cy

See Also

wind_pcm_th, ID_pcm, and ID, which employ this function. In addition, see plm_th for the case of detecting changes in the slope of a piecewise-linear and continuous signal via thresholding.

Examples

single.cpt <- c(rep(4,1000),rep(0,1000))
single.cpt.noise <- single.cpt + rnorm(2000)
cpt.single.th <- pcm_th(single.cpt.noise)

three.cpt <- c(rep(4,500),rep(0,500),rep(-4,500),rep(1,500))
three.cpt.noise <- three.cpt + rnorm(2000)
cpt.three.th <- pcm_th(three.cpt.noise)

multi.cpt <- rep(c(rep(0,50),rep(3,50)),20)
multi.cpt.noise <- multi.cpt + rnorm(2000)
cpt.multi.th <- pcm_th(multi.cpt.noise)

IDetect documentation built on May 7, 2026, 5:09 p.m.