AnomalyDetectionVec: Anomaly Detection Using Seasonal Hybrid ESD Test

Description Usage Arguments Value References See Also Examples

View source: R/vec_anom_detection.R

Description

A technique for detecting anomalies in seasonal univariate time series where the input is a series of observations.

Usage

1
2
3
4
5
6
7
AnomalyDetectionVec(x, max_anoms = 0.1, direction = "pos", alpha = 0.05,
  period = NULL, only_last = FALSE, threshold = "None", e_value = FALSE,
  longterm_period = NULL, verbose = FALSE)

ad_vec(x, max_anoms = 0.1, direction = "pos", alpha = 0.05,
  period = NULL, only_last = FALSE, threshold = "None", e_value = FALSE,
  longterm_period = NULL, verbose = FALSE)

Arguments

x

Time series as a column data frame, list, or vector, where the 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.

period

Defines the number of observations in a single period, and used during seasonal decomposition.

only_last

Find and report anomalies only within the last period in the time series.

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_period

Defines the number of observations for which the trend can be considered flat. The value should be an integer multiple of the number of observations in a single period. This increases anom detection efficacy for time series that are greater than a month.

verbose

Enable debug messages

Value

The returned value is a list with the following components.

Data frame containing index, values, and optionally expected values.

References

See Also

ad_ts()

Examples

1
2
3
4
5
6
7
8
9
data(raw_data)

ad_vec(raw_data[,2], max_anoms=0.02, period=1440, direction='both')

# To detect only the anomalies in the last period, run the following:

ad_vec(
  raw_data[,2], max_anoms=0.02, period=1440, direction='both', only_last=TRUE
)

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