safely_detect_changepoints {rSAFE} | R Documentation |
Identifying Changes in a Series Using PELT Algorithm
Description
The safely_detect_changepoints() function calculates the optimal positioning and number of changepoints for given data and penalty. It uses a PELT algorithm with a nonparametric cost function based on the empirical distribution. The implementation is inspired by the code available on https://github.com/rkillick/changepoint.
Usage
safely_detect_changepoints(data, penalty = "MBIC", nquantiles = 10)
Arguments
data |
a vector within which you wish to find changepoints |
penalty |
penalty for introducing another changepoint, one of "AIC", "BIC", "SIC", "MBIC", "Hannan-Quinn" or numeric non-negative value |
nquantiles |
the number of quantiles used in integral approximation |
Value
a vector of optimal changepoint positions (last observations of each segment)
See Also
Examples
library(rSAFE)
data <- rep(c(2,7), each=4)
safely_detect_changepoints(data)
set.seed(123)
data <- c(rnorm(15, 0), rnorm(20, 2), rnorm(30, 8))
safely_detect_changepoints(data)
safely_detect_changepoints(data, penalty = 25)
[Package rSAFE version 0.1.4 Index]