The region twin of stat_changepoint(): runs detection on
the layer's own x/y and draws what the method returns as
an interval, so
ggplot(d, aes(t, y)) + geom_line() + stat_cpt_region() is the
whole plot. Narrowest Significance Pursuit (method = "nsp", the
default) returns regions, each containing a changepoint at a global
significance level; a method with location intervals ("smuce",
"strucchange", "segmented", ...) draws those instead.
Usage
stat_cpt_region(
mapping = NULL,
data = NULL,
geom = GeomCptRegion,
position = "identity",
...,
method = "nsp",
na.rm = FALSE,
show.legend = NA
)Arguments
- mapping
Aesthetic mappings.
- data
A data frame.
- geom
The geom to draw with. Defaults to
geom_cpt_region()'s.- position
Position adjustment.
- ...
Further arguments: those
cpt_detect()takes (for examplealphafor NSP's level) go to the detector, the rest to the geom.- method
Detection method:
"nsp"(the default) or any method whose result carries regions or location intervals (seecpt_methods()$ci).- na.rm
If
FALSE, missing values are removed.- show.legend
Whether to show legend.
See also
Other ggplot2 layers:
geom_changepoint(),
geom_cpt_ci(),
geom_cpt_event(),
geom_cpt_label(),
geom_cpt_region(),
geom_cpt_segment(),
ggchangepoint-ggproto,
stat_changepoint()

