View source: R/safely_detect_changepoints.R
safely_detect_changepoints | R Documentation |
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.
safely_detect_changepoints(data, penalty = "MBIC", nquantiles = 10)
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 |
a vector of optimal changepoint positions (last observations of each segment)
safely_transform_continuous
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.