Wraps cpm::processStream() (Ross, 2015) for distribution-free
sequential changepoint detection via repeated two-sample tests
(Mann-Whitney for location, Mood for scale, Lepage, Kolmogorov-Smirnov and
Cramer-von-Mises for general changes, and parametric Student/Bartlett/GLR
variants). Although the engine is designed for streams, it is run here
over the full series in one pass, mimicking online monitoring with average
run length arl0.
Arguments
- x
A numeric vector.
- cpm_type
Test statistic, passed to
cpm::processStream()ascpmType. Distribution-free:"Mann-Whitney"(location, the default),"Mood"(scale),"Lepage","Kolmogorov-Smirnov","Cramer-von-Mises". Parametric:"Student","Bartlett","GLR"(Gaussian),"Exponential"(positive data),"FET"(Fisher's exact test, for 0/1 Bernoulli data, with a smoothinglambdapassed through...:0.1, cpm's default, or0.3).- arl0
Target in-control average run length (how many observations, on average, before a false alarm). cpm ships thresholds only for a fixed grid (100, 200, 300, 370, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 40000 and 50000), and any other value is refused, because the engine answers it by printing an error and reporting no changepoints. The grid is the same for every
cpm_type, and 50000 is the ceiling: a long series cannot be given anarl0proportional to its length indefinitely.When
NULL(the default) it scales with the series: the smallest grid value of at least \(5n\), capped at 50000. A sequential test run over a whole series raises about \(n / \mathrm{arl0}\) false alarms, so the streaming default of 500 meant 36 changepoints on 10,000 observations with 4 real ones, and 350 on 100,000; \(5n\) turned the 36 into exactly the 4. The expected count is recorded as$diagnostics$expected_false_positives. Passarl0 = 500for the 0.5.0 behaviour, and usecpt_monitor()for genuine streaming, whose default is unchanged.- startup
Number of observations after each restart before monitoring begins. Defaults to
20.- ...
Additional arguments passed to
cpm::processStream().
Value
A ggcpt object. The changepoints tibble carries a
detection_time column: the index at which the sequential test
flagged each change (always later than the estimated location).
References
Ross GJ (2015). “Parametric and nonparametric sequential change detection in R: The cpm package.” Journal of Statistical Software, 66(3), 1–20.
See also
Other changepoint engines:
bcp_wrapper(),
beast_wrapper(),
bfast_wrapper(),
binsegrcpp_wrapper(),
bocpd_wrapper(),
cpop_wrapper(),
cpt_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()
