View source: R/Finalised_coding.R
| cumsum_lin | R Documentation |
This function returns the values of the contrast function, which is used for for change-point detection in continuous piecewise-linear mean signals. See Details for more information.
cumsum_lin(x)
x |
A numeric vector containing the data. |
The mathematical expression of the result returned by cumsum_lin
is rather large. Therefore, for the exact formula please see the relevant subsection
for piecewise-linearity in the preprint “Detecting multiple generalized
change-points by isolating single ones”, Anastasiou and Fryzlewicz (2017).
A numeric vector with the contrast function values at b = 1,2,...,T-1,
where T is the length of x. Note that due to the structure of the
signal (piecewise-linear mean), the value of the contrast function statistic at
b=1 is equal to zero.
Andreas Anastasiou, anastasiou.andreas@ucy.ac.cy
cusum_function for the calculation of the CUSUM statistic,
which is the contrast function used in the case of piecewise-constant mean signals.
no.cpt.noise <- rnorm(2000)
cf.no.cpt <- IDetect:::cumsum_lin(no.cpt.noise)
single.cpt <- c(seq(0, 999, 1), seq(998.5, 499, -0.5))
single.cpt.noise <- single.cpt + rnorm(2000)
cf.single.cpt <- IDetect:::cumsum_lin(single.cpt.noise)
#*** Notice that the maximum in absolute value of \code{csm.single.cpt}
#*** occurs in a neighbourhood of the true change-point, which is 1000.
which.max(abs(cf.single.cpt))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.