Description Usage Arguments Value Author(s) Examples
View source: R/Finalised_coding.R
This function returns the difference between x
and the estimated signal
with change-points at cpt
. The input in the argument type_chg
will
indicate the type of changes in the signal.
1 2 |
x |
A numeric vector containing the data. |
cpt |
A positive integer vector with the locations of the change-points.
If missing, the |
type_chg |
A character string, which defines the type of the detected change-points.
If |
type_res |
A choice of |
If type_res = ``raw''
, the function returns the difference between the data
and the estimated signal. If type_res = ``standardised''
, then the function
returns the difference between the data and the estimated signal, divided by
the estimated standard deviation.
Andreas Anastasiou, a.anastasiou@lse.ac.uk
1 2 3 4 5 6 7 8 9 10 11 12 | single.cpt.pcm <- c(rep(4,1000),rep(0,1000))
single.cpt.pcm.noise <- single.cpt.pcm + rnorm(2000)
cpt_detect <- ID(single.cpt.pcm.noise, contrast = "mean")
residuals_cpt_raw <- resid_ID(single.cpt.pcm.noise, cpt = cpt_detect$cpt, type_chg = "mean",
type_res = "raw")
residuals_cpt_stand. <- resid_ID(single.cpt.pcm.noise, cpt = cpt_detect$cpt, type_chg = "mean",
type_res = "standardised")
plot(residuals_cpt_raw)
plot(residuals_cpt_stand.)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.