Wraps cpop::cpop() (Fearnhead, Maidstone and Letchford, 2019;
Fearnhead and Grose, 2024): exact penalised estimation of a
continuous piecewise-linear mean via dynamic programming with
functional pruning. This is the engine behind
cpt_detect(change_in = "slope"). The fitted broken line is stored
in the fitted column and renders via
autoplot(show_fit = TRUE).
Arguments
- x
A numeric vector.
- penalty
Penalty for adding a changepoint. Defaults to
2 * log(length(x)).- sd
Noise standard deviation; when
NULLit is estimated from the data by the engine's default difference-based estimator.- ...
Additional arguments passed to
cpop::cpop().
Value
A ggcpt object with change_in = "slope". For a
continuous fit the reported location is the kink point itself.
References
Fearnhead P, Maidstone R, Letchford A (2019). “Detecting changes in slope with an L0 penalty.” Journal of Computational and Graphical Statistics, 28(2), 265–275.
Fearnhead P, Grose D (2024). “cpop: Detecting changes in piecewise-linear signals.” Journal of Statistical Software, 109(7), 1–30.

