| detect_anomalies | R Documentation |
A statistical check on the values themselves – distinct from the
Holidays tab's consistency check (calendar-vs-declared-holiday
mismatch). Uses the STL remainder when decompose_series() finds one
(isolates unusual points from normal trend/seasonal movement, which a
raw-value check can't); falls back to deviation from a running median
when no seasonal decomposition applies (short series, yearly
aggregation, etc.), so it still works on every series shape.
detect_anomalies(
df,
date_agg = "day",
method = c("iqr", "zscore"),
threshold = 1.5
)
df |
A tibble with |
date_agg |
Aggregation frequency: one of |
method |
|
threshold |
Numeric sensitivity threshold. Default |
A tibble with columns ds, y, score (the value the
threshold was applied to), and is_anomaly (logical).
df <- tibble::tibble(ds = as.Date("2024-01-01") + 0:29, y = c(rep(10, 29), 100))
detect_anomalies(df, date_agg = "day", method = "iqr")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.