| cpt_wrapper | R Documentation |
This function wraps a number of cpt functions from the changepoint
package and the cpt.np() function from the changepoint.np package.
It is handy that users can use this function to get the same changepoint
results as these functions output individually. Moreover, it returns a tibble
that inherits the tidyverse style. Functions from the changepoint package do
require data normality assumption by default, yet changepoint.np is a
non-parametric way to detect changepoints and let data speak by itself.
If user sets change_in as np (or cpt_np), a seed should
be set before using the function for the sake of reproducibility. For more
details on the changepoint and changepoint.np packages, please refer to
their documentation.
cpt_wrapper(data, change_in = "mean_var", cp_method = "PELT", ...)
data |
A numeric vector. |
change_in |
Choice of |
cp_method |
A wide range of choices (i.e., |
... |
Extra arguments for each |
A tibble including which point(s) is/are the changepoint along with
raw changepoint value corresponding to that changepoint. Changepoint
locations follow the convention of the changepoint package: the
last index of the left segment. The upstream cpt object is
attached as the "ggcpt_fit" attribute, which is what
cpt_detect() stores in the result's $fit.
With change_in = "mean" the upstream Normal cost assumes a noise
standard deviation of 1 and the penalty is compared against the raw
residual sum of squares, so a series with wider noise is under-penalised
and over-segmented: about 39 changepoints instead of 1 at
\sigma = 3 on 200 observations (mean over 20 draws). Standardise the series first, or use
change_in = "mean_var", which estimates a variance per segment and
is unaffected. See the scale-sensitivity section of
cpt_detect.
killick2014changepointggchangepoint
Other changepoint engines:
bcp_wrapper(),
beast_wrapper(),
bfast_wrapper(),
binsegrcpp_wrapper(),
bocpd_wrapper(),
capa_wrapper(),
cpm_wrapper(),
cpop_wrapper(),
decafs_wrapper(),
ecp_wrapper(),
envcpt_wrapper(),
esac_wrapper(),
fabisearch_wrapper(),
fastcpd_wrapper(),
fcov_wrapper(),
fmean_wrapper(),
fpop_wrapper(),
geomcp_wrapper(),
hdcov_wrapper(),
hdreg_wrapper(),
idetect_wrapper(),
inspect_wrapper(),
kcp_wrapper(),
kwc_wrapper(),
mcp_wrapper(),
mosum_wrapper(),
network_wrapper(),
not_wrapper(),
npmojo_wrapper(),
nsp_wrapper(),
ocd_wrapper(),
pilliat_wrapper(),
segmented_wrapper(),
smuce_wrapper(),
sn_wrapper(),
strucchange_wrapper(),
taylor_wrapper(),
tguh_wrapper(),
trend_wrapper(),
var_wrapper(),
wbs2_wrapper(),
wbs_wrapper(),
wbsts_wrapper()
set.seed(2022)
cpt_wrapper(c(rnorm(100,0,1),rnorm(100,0,10)))
cpt_wrapper(c(rnorm(100,0,1),rnorm(100,10,1)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.