View source: R/Finalised_coding.R
| plm_th | R Documentation |
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 slope of a piecewise-linear mean of a given data sequence.
plm_th(
x,
sigma = stats::mad(diff(diff(x)))/sqrt(6),
thr_const = 1.4,
thr_fin = sigma * thr_const * sqrt(2 * log(length(x))),
s = 1,
e = length(x),
points = 3,
k_l = 1,
k_r = 1
)
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 |
thr_const |
A positive real number with default value equal to 1.4. It is
used to define the threshold. The change-points are estimated by thresholding
with threshold equal to |
thr_fin |
A positive real number with default value equal to
|
s, e |
Positive integers with |
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. |
The change-point detection algorithm that is used in plm_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.
A numeric vector with the detected change-points.
Andreas Anastasiou, anastasiou.andreas@ucy.ac.cy
wind_plm_th, ID_plm, and ID, which employ
this function. In addition, see pcm_th for the case of detecting changes in
the mean of a piecewise-constant signal via thresholding.
single.cpt <- c(seq(0, 999, 1), seq(998.5, 499, -0.5))
single.cpt.noise <- single.cpt + rnorm(2000)
cpt.single.th <- plm_th(single.cpt.noise)
three.cpt <- c(seq(0, 499, 1), seq(498.5, 249, -0.5), seq(251,1249,2), seq(1248,749,-1))
three.cpt.noise <- three.cpt + rnorm(2000)
cpt.three.th <- plm_th(three.cpt.noise)
multi.cpt <- rep(c(seq(0,49,1), seq(48,0,-1)),20)
multi.cpt.noise <- multi.cpt + rnorm(1980)
cpt.multi.th <- plm_th(multi.cpt.noise)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.