View source: R/detect_changepoint.R
| detect_changepoint | R Documentation |
Aggregate group-level counts to detect significant change point(s) in counts.
detect_changepoint( group_timeseries_data, group_id, num_cpts = 1, include_data = FALSE, include_model = FALSE )
group_timeseries_data |
contains time-series data for each ts over the same period of time. Requires the following columns:
|
group_id |
unique identifier for the group |
num_cpts |
maximum number of change points to detect |
include_data |
whether to include data in response |
include_model |
whether to include change point model in response |
num_dates <- 90
num_timeseries <- 30
test_data <- merge(paste0("ts_", 1:num_timeseries),
seq(Sys.Date(), Sys.Date() + (num_dates - 1), by = 1),
colnames = c("foo", "bar"))
start_date <- Sys.Date() + floor(num_dates / 2)
test_data$count <- sapply(1:(num_dates*num_timeseries),
function(x) { rnorm(1, 50, 20) })
test_data <- setNames(test_data, c("ts_id", "date", "count"))
detect_changepoint(
test_data, "test_analysis", include_data = FALSE, include_model = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.