cpt_null_power: What an empty answer could have detected

View source: R/null.R

cpt_null_powerR Documentation

What an empty answer could have detected

Description

When a detection comes back empty, the useful question is whether a change of the size you care about would have been found. This runs cpt_min_detectable() at the fit's own length, method and penalty, with the noise level estimated from the series, and reports the smallest shift detected with the requested power: changes smaller than that could well be there and missed.

Usage

cpt_null_power(fit, power = 0.8, n_sim = 50, seed = NULL, ...)

## S3 method for class 'ggcpt_null_power'
print(x, ...)

## S3 method for class 'ggcpt_null_power'
tidy(x, ...)

Arguments

fit

A ggcpt object (usually one with no changepoints; it works for any).

power

Target power. Defaults to 0.8.

n_sim

Simulations per power evaluation. Defaults to 50.

seed

Optional seed, scoped to this call.

...

Further arguments for cpt_min_detectable().

x

A ggcpt_null_power object.

Value

A ggcpt_null_power list with n, sigma (the noise level used), jump (the smallest detectable change, in the data's units), jump_sd (the same in noise standard deviations), change_in (the fit's change type, which sets what jump measures: a shift in the mean, a rise in the standard deviation, both, or a trend, as cpt_power() defines them), power, method and constant (TRUE when the series has no variation, in which case nothing is simulated). With print() and tidy() methods. A formula fit is refused: the simulation has no covariates to draw.

See Also

Other inference: cpt_abruptness(), cpt_assumptions(), cpt_attribute(), cpt_attribute_event(), cpt_confint_coverage(), cpt_effect(), cpt_gof(), cpt_k_weights(), cpt_robustness(), cpt_screen(), cpt_test_at(), cpt_test_null()

Examples


set.seed(1)
fit <- cpt_detect(rnorm(100), method = "pelt")
cpt_null_power(fit, n_sim = 20, seed = 1)


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