This repository was archived by the owner on Nov 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 775
/
Copy pathAnomalyDetectionVec.Rd
97 lines (77 loc) · 3.89 KB
/
AnomalyDetectionVec.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
% Generated by roxygen2 (4.1.0): do not edit by hand
% Please edit documentation in R/vec_anom_detection.R
\docType{data}
\name{AnomalyDetectionVec}
\alias{AnomalyDetectionVec}
\title{Anomaly Detection Using Seasonal Hybrid ESD Test}
\usage{
AnomalyDetectionVec(x, max_anoms = 0.1, direction = "pos", alpha = 0.05,
period = NULL, only_last = F, threshold = "None", e_value = F,
longterm_period = NULL, plot = F, y_log = F, xlabel = "",
ylabel = "count", title = NULL, verbose = FALSE)
}
\arguments{
\item{x}{Time series as a column data frame, list, or vector, where the column consists of
the observations.}
\item{max_anoms}{Maximum number of anomalies that S-H-ESD will detect as a percentage of the
data.}
\item{direction}{Directionality of the anomalies to be detected. Options are:
\code{'pos' | 'neg' | 'both'}.}
\item{alpha}{The level of statistical significance with which to accept or reject anomalies.}
\item{period}{Defines the number of observations in a single period, and used during seasonal
decomposition.}
\item{only_last}{Find and report anomalies only within the last period in the time series.}
\item{threshold}{Only report positive going anoms above the threshold specified. Options are:
\code{'None' | 'med_max' | 'p95' | 'p99'}.}
\item{e_value}{Add an additional column to the anoms output containing the expected value.}
\item{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.}
\item{plot}{A flag indicating if a plot with both the time series and the estimated anoms,
indicated by circles, should also be returned.}
\item{y_log}{Apply log scaling to the y-axis. This helps with viewing plots that have extremely
large positive anomalies relative to the rest of the data.}
\item{xlabel}{X-axis label to be added to the output plot.}
\item{ylabel}{Y-axis label to be added to the output plot.}
\item{title}{Title for the output plot.}
\item{verbose}{Enable debug messages}
}
\value{
The returned value is a list with the following components.
\item{anoms}{Data frame containing index, values, and optionally expected values.}
\item{plot}{A graphical object if plotting was requested by the user. The plot contains
the estimated anomalies annotated on the input time series.}
One can save \code{anoms} to a file in the following fashion:
\code{write.csv(<return list name>[["anoms"]], file=<filename>)}
One can save \code{plot} to a file in the following fashion:
\code{ggsave(<filename>, plot=<return list name>[["plot"]])}
}
\description{
A technique for detecting anomalies in seasonal univariate time series where the input is a
series of observations.
}
\details{
\code{longterm_period} This option should be set when the input time series is longer than a month.
The option enables the approach described in Vallis, Hochenbaum, and Kejariwal (2014).\cr\cr
\code{threshold} Filter all negative anomalies and those anomalies whose magnitude is smaller
than one of the specified thresholds which include: the median
of the daily max values (med_max), the 95th percentile of the daily max values (p95), and the
99th percentile of the daily max values (p99).
}
\examples{
data(raw_data)
AnomalyDetectionVec(raw_data[,2], max_anoms=0.02, period=1440, direction='both', plot=TRUE)
# To detect only the anomalies in the last period, run the following:
AnomalyDetectionVec(raw_data[,2], max_anoms=0.02, period=1440, direction='both',
only_last=TRUE, plot=TRUE)
}
\references{
Vallis, O., Hochenbaum, J. and Kejariwal, A., (2014) "A Novel Technique for
Long-Term Anomaly Detection in the Cloud", 6th USENIX, Philadelphia, PA.
Rosner, B., (May 1983), "Percentage Points for a Generalized ESD Many-Outlier Procedure"
, Technometrics, 25(2), pp. 165-172.
}
\seealso{
\code{\link{AnomalyDetectionTs}}
}
\keyword{datasets}