cusum_one: Calculate the CUMSUM statistic at specific values

View source: R/Finalised_coding.R

cusum_oneR Documentation

Calculate the CUMSUM statistic at specific values

Description

This function returns the CUMSUM statistic at predefined positions of a given data sequence. The routine is typically not called directly by the user; its result is used in the derivation of the solution path in the case of a piecewise-constant mean signal, which is carried out in sol_path_pcm.

Usage

cusum_one(x, s, e, b)

Arguments

x

A numeric vector containing the data.

s, e, b

Positive integer vectors, all of the same length l_b, with s_j \le b_j < e_j, j=1,2,...,l_b. They indicate that for each j=1,2,...,l_b, the function needs to calculate the CUSUM statistic value at position b_j, with start- and end-points at positions s_j and e_j, respectively.

Value

A numeric vector of length l_b, of which the j^{th} element is the CUSUM statistic value at b_j, when the start- and end-points are s_j and e_j, respectively.

Author(s)

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

See Also

cusum_function for the calculation of the CUSUM statistic for all data points of x. Also, see linear_contr_one for a function that has the same purpose, but for the case of the contrast function for continuous and piecewise-linear mean signals.

Examples

no.cpt.noise <- rnorm(2000)
ex1 <- IDetect:::cusum_one(no.cpt.noise, s = c(1, 5, 9), e = c(30, 56, 71), b = c(20, 40, 45))

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