AnomalyDetectionTs: Anomaly Detection Using Seasonal Hybrid ESD Test

Description Usage Arguments Value References See Also Examples

View source: R/ts_anom_detection.R

Description

A technique for detecting anomalies in seasonal univariate time series where the input is a series of <timestamp, count> pairs.

Usage

1
2
3
4
5
6
7
8
9
AnomalyDetectionTs(x, max_anoms = 0.1, direction = "pos", alpha = 0.05,
  only_last = NULL, threshold = "None", e_value = FALSE,
  longterm = FALSE, piecewise_median_period_weeks = 2, verbose = FALSE,
  na.rm = FALSE)

ad_ts(x, max_anoms = 0.1, direction = "pos", alpha = 0.05,
  only_last = NULL, threshold = "None", e_value = FALSE,
  longterm = FALSE, piecewise_median_period_weeks = 2, verbose = FALSE,
  na.rm = FALSE)

Arguments

x

Time series as a two column data frame where the first column consists of the timestamps and the second column consists of the observations.

max_anoms

Maximum number of anomalies that S-H-ESD will detect as a percentage of the data.

direction

Directionality of the anomalies to be detected. One of: pos, neg, both.

alpha

The level of statistical significance with which to accept or reject anomalies.

only_last

Find and report anomalies only within the last day or hr in the time seriess. One of NULL, day, hr.

threshold

Only report positive going anoms above the threshold specified. One of: None, med_max, p95, p99.

e_value

Add an additional column to the anoms output containing the expected value.

longterm

Increase anom detection efficacy for time series that are greater than a month. See 'Details“ below.

piecewise_median_period_weeks

The piecewise median time window as described in Vallis, Hochenbaum, and Kejariwal (2014). Defaults to 2.

verbose

Enable debug messages

na.rm

Remove any NAs in timestamps.(default: FALSE)

Value

The returned value is a data frame containing timestamps, values, and optionally expected values.

References

See Also

ad_vec()

Examples

1
2
3
4
5
6
7
data(raw_data)

ad_ts(raw_data, max_anoms=0.02, direction='both')

# To detect only the anomalies on the last day, run the following:

ad_ts(raw_data, max_anoms=0.02, direction='both', only_last="day")

Harminder858/anomaly_twitter_harminder documentation built on March 29, 2020, 5:33 a.m.