Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/Finalised_coding.R
This is the main, general function of the package. It employs more specialised functions in
order to estimate the number and locations of multiple changepoints in the noisy, piecewiseconstant
or continuous, piecewiselinear input vector xd
. The noise can either follow the Gaussian
distribution or not. The approach that is followed is a hybrid between the thresholding approach
(explained in pcm_th
and cplm_th
) and the information criterion approach
(explained in pcm_ic
and cplm_ic
) and estimates the changepoints
taking into account both these approaches. Further to the number and the location of the estimated
changepoints, ID
, returns the estimated signal, as well as the solution path.
For more information and the relevant literature reference, see Details.
1 2 3 
xd 
A numeric vector containing the data in which you would like to find changepoints. 
th.cons 
A positive real number with default value equal to 1. It is
used to define the threshold, if the thresholding approach (explained in 
th.cons_lin 
A positive real number with default value equal to 1.4. It is
used to define the threshold, if the thresholding approach (explained in 
th.ic 
A positive real number with default value equal to 0.9. It is
useful only if the model selection based IsolateDetect method (described in

th.ic.lin 
A positive real number with default value equal to 1.25. It is
useful only if the model selection based IsolateDetect method (described in

lambda 
A positive integer with default value equal to 3. It is used only when the threshold based approach is to be followed and it defines the distance between two consecutive end or startpoints of the right or leftexpanding intervals, respectively. 
lambda.ic 
A positive integer with default value equal to 10. It is used only when the information criterion based approach is to be followed and it defines the distance between two consecutive end or startpoints of the right or leftexpanding intervals, respectively. 
contrast 
A character string, which defines the type of the contrast function to
be used in the IsolateDetect algorithm. If 
ht 
A logical variable with default value equal to 
scale 
A positive integer number with default value equal to 3. It is
used to define the way we preaverage the given data sequence only if

The data points provided in xd
are assumed to follow
X_t = f_t + σε_t; t = 1,2,...,T,
where T is the total length of the data sequence, X_t are the observed data, f_t is a onedimensional, deterministic signal with abrupt structural changes at certain points, and ε_t are independent and identically distributed random variables with mean zero and variance one. In this function, the following scenarios for f_t are implemented.
Piecewiseconstant signal with Gaussian noise.
Use contrast = ``mean''
and ht = FALSE
here.
Piecewiseconstant signal with heavytailed noise.
Use contrast = ``mean''
and ht = TRUE
here.
Continuous, piecewiselinear signal with Gaussian noise.
Use contrast = ``slope''
and ht = FALSE
here.
Continuous, piecewiselinear signal with heavytailed noise.
Use contrast = ``slope''
and ht = TRUE
here.
In the case where ht = FALSE
: the function firstly detects the changepoints using
win_pcm_th
(for the case of piecewiseconstant signal) or win_cplm_th
(for the case of continuous, piecewiselinear signal). If the estimated number of changepoints
is greater than 100, then the result is returned and we stop. Otherwise, ID
proceeds
to detect the changepoints using pcm_ic
(for the case of piecewiseconstant signal)
or cplm_ic
(for the case of continuous, piecewiselinear signal) and this is what is
returned.
In the case where ht = TRUE
: First we preaverage the given data sequence using normalise
and then, on the obtained data sequence, we follow exactly the same procedure as the one when ht = FALSE
above.
More details can be found in “Detecting multiple generalized changepoints by isolating single ones”,
Anastasiou and Fryzlewicz (2018), preprint.
A list with the following components:
cpt  A vector with the detected changepoints. 
no_cpt  The number of changepoints detected. 
fit  A numeric vector with the estimated signal. 
solution_path  A vector containing the solution path. 
Andreas Anastasiou, a.anastasiou@lse.ac.uk
ID_pcm
, ID_cplm
, ht_ID_pcm
, and
ht_ID_cplm
, which are the functions that are employed
in ID
, depending on which scenario is imposed by the input arguments.
1 2 3 4 5 6 7 8 9 10 11  single.cpt.mean < c(rep(4,3000),rep(0,3000))
single.cpt.mean.normal < single.cpt.mean + rnorm(6000)
single.cpt.mean.student < single.cpt.mean + rt(6000, df = 5)
cpt.single.mean.normal < ID(single.cpt.mean.normal)
cpt.single.mean.student < ID(single.cpt.mean.student, ht = TRUE)
single.cpt.slope < c(seq(0, 1999, 1), seq(1998, 1, 1))
single.cpt.slope.normal < single.cpt.slope + rnorm(4000)
single.cpt.slope.student < single.cpt.slope + rt(4000, df = 5)
cpt.single.slope.normal < ID(single.cpt.slope.normal, contrast = "slope")
cpt.single.slope.student < ID(single.cpt.slope.student, contrast = "slope", ht = TRUE)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.