# Segment a time series using a genetic algorithm
res <- segment_ga(CET, maxiter = 5)
summary(res)
str(res)
plot(res)
# \donttest{
# Segment a time series using Shi's algorithm
x <- segment(CET, method = "ga-shi", maxiter = 5)
str(x)
# Segment a time series using Coen's algorithm
y <- segment(CET, method = "ga-coen", maxiter = 5)
changepoints(y)
# Segment a time series using Coen's algorithm and an arbitrary threshold
z <- segment(CET, method = "ga-coen", maxiter = 5,
model_fn_args = list(threshold = 2))
changepoints(z)
# }
if (FALSE) {
# This will take a really long time!
x <- segment(CET, method = "ga-shi", maxiter = 500, run = 100)
changepoints(x)
# This will also take a really long time!
y <- segment(CET, method = "ga", model_fn = fit_lmshift, penalty_fn = BIC,
popSize = 200, maxiter = 5000, run = 1000,
model_fn_args = list(trends = TRUE),
population = build_gabin_population(CET)
)
}
if (FALSE) {
x <- segment(method = "ga-coen", maxiter = 50)
}
x <- segment(CET, method = "random")
Run the code above in your browser using DataLab