cpt_statistic: The detector's statistic as a function of location

View source: R/diagnostics.R

cpt_statisticR Documentation

The detector's statistic as a function of location

Description

Returns the criterion the engine evaluated at each position, which is what explains why a changepoint landed where it did. Available for the engines that expose it (subset(cpt_methods(), statistic)$method lists them), and an error naming those engines for the ones that do not.

Usage

cpt_statistic(object)

ggcpt_statistic(object)

Arguments

object

A ggcpt object.

Value

cpt_statistic() returns a tibble with index, statistic, threshold (the engine's rejection threshold, or NA) and label (what the statistic is). ggcpt_statistic() returns a two-panel ggplot: the series above, the statistic below, sharing the x axis.

See Also

cpt_solution_path(), cpt_scale_space().

Examples


set.seed(2026)
fit <- cpt_detect(c(rnorm(200), rnorm(200, 3)), method = "mosum")
head(cpt_statistic(fit))
ggcpt_statistic(fit)


ggchangepoint documentation built on Nov. 5, 2026, 9:06 a.m.